Hi folks,
I'm trying to get 'preg_match' to find/match 'e.g. - London, UK'. I have '/e\.g\.\s\-\sLondon,\sUK/', is this the correct format?
I have even tried 'e\.g\.' in the the hope it will just find 'e.g.' but with no results.
spence
| SitePoint Sponsor |
That's VERY specific, and technically, you're not looking for a pattern. So personally, I'd just go with strpos and the like to test for its existence.
@AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.
Got to agree with Anthony on this.
However, if (and only if) this IS part of an actual pattern match, I don't think you'd need to escape the dash.
Jake Arkinstall
"Sometimes you don't need to reinvent the wheel;
Sometimes its enough to make that wheel more rounded"-Molona
Bookmarks