Re: preg guru question
| From: | André Cerqueira | Date: | Sat, 14 Feb 2004 05:24:51 +0000 |
| Subject: | Re: preg guru question | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-177679@lists.php.net to get a copy of this message | ||
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
oops...
sorry
strange bug happened on my newsreader...
'joel boonstra' regex seems to be the better one hehe
all others forgot that if u start with ', u must end with ' hehe (same thing with " :p)
i dont know why i used square brakets for \s... kinda stupid hehe
André cerqueira wrote:
did you post the same message 7 times? try: <? $subject = '<img src="THIS12BIT.ext">'; $pattern = '/<img[\s]+?src=[\'"](.+?)[\'"].*?>/i'; $matchFound = preg_match_all ($pattern, $subject, $matches, PREG_SET_ORDER); print_r($matches); //$matches[$i][1] is what really matters ?> that pattern may not be the best regex to use, but i think it works for most cases Pete M wrote:Version: GnuPG v1.2.4 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFALbEmaxdA/5C8vH8RArxLAJwNJXHouP4meJXRo4c+8xye12H/4QCgk5gE YHIReAkKxtFwyD7dLWZIPWc= =2eBJ -----END PGP SIGNATURE----------BEGIN PGP SIGNATURE-----Im trying to scan a file and lift the image name from the <img tag ie <img src="THISBIT.ext"> where there could be ' or " I messed around but am 2 embarassed to post code cos it dont work ;-( thanks in advance pete