The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Need some Regex help
Hello there,
So we were getting annoyed on our forums with stupid registration names. So we wanna setup a regex now so that they can't do this anymore. I know that this feature is available in the admin panel and we will also use that. I just need some help with the regex. Basicly what we want is we wanna allow these chars a-z A-Z 1234567890 and one space inbetween the name. The space inbetween the name is not a MUST, but if there are spaces in the name it should only be inside the name, and it should only be one. If anyone could help me with this one it would be greatly appreciated. |
#2
|
|||
|
|||
I think this works:
Code:
^[A-Za-z0-9]+\s?[A-Za-z0-9]+$ |
#3
|
|||
|
|||
Quote:
Thanks alot. |
#4
|
|||
|
|||
I found that some people use seperators more than once in a row so I had to make sure that the first and last character are not separators, and that there's never more than one separator in a row. Here's my way:
/^[A-Za-z0-9]+(?:[ _-][A-Za-z0-9]+)*$/ After matching one or more alphanumeric characters, if there's a separator it must be followed by one or more alphanumerics. |
#5
|
|||
|
|||
Quote:
Thanks for the great help (y) |
Благодарность от: | ||
Black Snow |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|