PHP regular expression
Posted
by Ferol
on Stack Overflow
See other posts from Stack Overflow
or by Ferol
Published on 2010-04-27T09:13:53Z
Indexed on
2010/04/27
9:23 UTC
Read the original article
Hit count: 302
such text:
$text = ' href="http://yahoo.com" target="_blank"> link text </a> text... text... <br> text...';
//
$text = ' text... <a href="http://yahoo.com" target="_blank"> link text </a> text... text... <br> text...';
and such regular expression:
preg_match_all('/^(.*)(<.+>)(.*)(<\/.+>)(.*)$/',$text,$matches);
what I want, - to check if text matches the regular expression. If yes, then $matches should contain parts of string above, if not (as I guess) it should contain four zero-length arrays.
something is wrong, but I can't find, what actually is?
© Stack Overflow or respective owner