Hallo,
I am becoming crazy because I am trying to use the following reg expression to allow only starting and ending letter or numbers from a string, one space or one - or . or _ are allowed.
My regular expression is:
([a-zA-Z0-9]+)[\040-._]?([a-zA-Z0-9-]+)$
and it is perfectly working with javascript but with php it doesn't
It seems like my PHP was unable to accept spaces.
ereg('([a-zA-Z0-9]+)[\040-._]?([a-zA-Z0-9-]+)$', $nick)
Why it isn't working in php ?
If i try with something like:
test test
due to the space it doesn't match.
I have also tryed with \s but nothing changes.
Do you have the answer ?
Is it also possible to mantain such format and control lenght also ?
I mean can I also say more than 2 but less then 18 chars for the full phrase ?
Thank you very much