Home > Archive > PHP Programming > April 2007 > I can not match "&" - regexp
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
I can not match "&" - regexp
|
|
| Papkin 2007-04-26, 3:59 am |
| Hi
if ( eregi("^[\&/[:space:]/a-zA-Z0-9±ęćłń󶿼ˇĆĘŁŃÓ¦¬Ż\.\/\/-]{2,65}$","Merry
& Cat") )
return true;
else
return false;
I'd like to match also "&" but this regexp above does not do this, adding \&
does not help. Any ideas?
Thank you
| |
| no@email.com 2007-04-26, 7:58 am |
| Papkin wrote:
> Hi
>
> if (
> eregi("^[\&/[:space:]/a-zA-Z0-9±ęćłń󶿼ˇĆĘŁŃÓ¦¬Ż\.\/\/-]{2,65}$","Merry
> & Cat") )
> return true;
> else
> return false;
>
> I'd like to match also "&" but this regexp above does not do this,
> adding \& does not help. Any ideas?
>
> Thank you
i see some pretty wild characters there.
give it a try with this
eregi('[a-z]+ \& [a-z]+', 'Merry & Cat')
| |
|
| no@email.com wrote:
> Papkin wrote:
>
> i see some pretty wild characters there.
> give it a try with this
>
> eregi('[a-z]+ \& [a-z]+', 'Merry & Cat')
>
Or use preg_match:
preg_match('|^[\s&a-z0-9±ęćłń󶿼ˇĆĘŁŃÓ¦¬Ż./\\-]{2,65}$|i',$string);
--
Rik Wasmus
Estimated date being able to walk again: 01-05-2007.
Less then a w , hurray!
|
|
|
|
|