The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
![]()
Hello,
I am just learning some of the regular expressions and I would like to make a code to check if the specific field contains two words.It is to check if the user entered his first and last name not only his first name.Is there also a way to check if the two words are the same?And maybe combine these two so they can be added into the vb custom field regex? Thank you very much! |
#2
|
||||
|
||||
![]()
<a href="http://www.regular-expressions.info/tutorial.html" target="_blank">http://www.regular-expressions.info/tutorial.html</a>
That is probably a good starting point to learn regex. |
#3
|
||||
|
||||
![]()
Yes,but I am not very familiar with regex yet,and I was hoping for a specific code
![]() |
#4
|
||||
|
||||
![]()
If you are looking for specific words then regex is not necessary. You only need it when looking for patterns (like words containing "abc")
For exact string matches you should use the php exact string functions (of which there are a bunch, and any php documentation will have them). To check if the field contains two words I would use explode and then check that the array contains two elements. Seeing if they are the same is just a matter of if ($names[0] == $names[1])..... (though you might like to correct for case insensitivity) |
#5
|
||||
|
||||
![]()
Oh yes,good idea
![]() |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|