evanct Posted June 7, 2009 Share Posted June 7, 2009 Someday I'll figure out how to write regular expressions. But for now I'm trying to see if the given string is formatted as an html link. this doesn't work: preg_match('^<a href=("|\')[.]("\')>[.](</a>)$',$value) Could you tell me what i'm doing wrong? Quote Link to comment https://forums.phpfreaks.com/topic/161306-solved-just-need-some-regex-help/ Share on other sites More sharing options...
.josh Posted June 7, 2009 Share Posted June 7, 2009 if you're just looking for a generic "are there anchor tags around this?" check: preg_match('~^<a[^>]*>.*?</a>$~i',$value); Quote Link to comment https://forums.phpfreaks.com/topic/161306-solved-just-need-some-regex-help/#findComment-851188 Share on other sites More sharing options...
evanct Posted June 7, 2009 Author Share Posted June 7, 2009 cool, that works, thanks Quote Link to comment https://forums.phpfreaks.com/topic/161306-solved-just-need-some-regex-help/#findComment-851192 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.