[re-sending, forgot to include list :-|] If you're matching a string and not a pattern then it is far more efficient to use strpos: if (strpos($path, '/realtors') !== FALSE) { echo 'Success'; } rob On 5/16/07, Al <news@xxxxxxxxxxxxx> wrote:
The "container", as you called it, are delimiters. They can be about any character you choose; but, stay away from preg control characters. Personally, I use "%" most of the time. It's a good habit to use delimiter characters that you can be certain will not be included in your strings. Then, you don't need to worry about escaping them in your string. Ed Curtis wrote: > I'm trying to use preg_match to find a string in a system path. > > What I need to do is see if the string '/realtors' exists in a variable > named '$path'. > > I know '/' is used as a container within the command itself. How do I > escape it to find the string '/realtors'? > > Thanks, > > Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- Rob Desbois Eml: rob.desbois@xxxxxxxxx Tel: 01452 760631 Mob: 07946 705987 "There's a whale there's a whale there's a whale fish" he cried, and the whale was in full view. ...Then ooh welcome. Ahhh. Ooh mug welcome.