Re: Regular Expressions...
| From: | Michael Sims | Date: | Fri, 31 May 2002 13:39:28 +0000 |
| Subject: | Re: Regular Expressions... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-100089@lists.php.net to get a copy of this message | ||
On Fri, 31 May 2002 12:32:29 +0100, you wrote:
>example of the contents of $file that might pass is:
>
>advance_racingx_14_4_29.pdf
>
>another might be, which would not pass is:
>
>advance_fork10_3_4_11.pdf
If you need it to be in that specific order, use the following:
if(preg_match("/advance.*racingx/",$string)) {
//do stuff
}
If the order doesn't matter, do this:
if(preg_match("/advance/",$string) && preg_match("/racingx/",$string))
{
//do stuff
}
There may be some more efficient/elegant ways to do this, but the
above should yield the results you are looking for.