Re: find string position using reg exp
| From: | Ben Ramsey | Date: | Mon, 29 Mar 2004 16:51:41 +0000 |
| Subject: | Re: find string position using reg exp | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-181682@lists.php.net to get a copy of this message | ||
RD> Why use a regular expression?
RD> strpos() will do this just fine.
strpos() will do it just fine, but if you need to use a regular expression to match a specific pattern and return the location in the string, preg_match() will also do this when you use the flag PREG_OFFSET_CAPTURE.
--
Regards,
Ben Ramsey
http://benramsey.com
http://www.phpcommunity.org/wiki/People/BenRamsey