jd2007 Posted October 5, 2007 Share Posted October 5, 2007 i want to find matches of anything like this : <a href="(these chars- a to z, A to Z, 0 to 9, _, (, ))-page">(these chars- a to z, A to Z)</a> i did this: $subject=file_get_contents(--a link--); preg_match_all('%/b^[a-zA-Z0-9_()]-page">[A-Za-z\s]/b%', $subject, $result, PREG_PATTERN_ORDER); print_r($result[0]); this is my regex: %/b^[a-zA-Z0-9_()]-page">[A-Za-z\s]/b% but i get no result...an empty array...why ? Quote Link to comment https://forums.phpfreaks.com/topic/71959-hi-i-need-help-in-forming-a-regex-pls/ Share on other sites More sharing options...
Yesideez Posted October 5, 2007 Share Posted October 5, 2007 There's a dedicated regex section this would be better off in. Quote Link to comment https://forums.phpfreaks.com/topic/71959-hi-i-need-help-in-forming-a-regex-pls/#findComment-362410 Share on other sites More sharing options...
MadTechie Posted October 5, 2007 Share Posted October 5, 2007 do you mean this ? <?php $test = '<a href="(testing123_-,)-page">(testing123_-,)-page</a>'; if (preg_match('/[a-z0-9()_,-]*(?=-)-page/i', $test)) { echo "found"; } else { echo "nothinf found"; } //also //preg_match_all('/[a-z0-9()_,-]*(?=-)-page/si', $test, $result, PREG_PATTERN_ORDER); //$result = $result[0]; ?> please move to RegEx Section! Quote Link to comment https://forums.phpfreaks.com/topic/71959-hi-i-need-help-in-forming-a-regex-pls/#findComment-362420 Share on other sites More sharing options...
jd2007 Posted October 5, 2007 Author Share Posted October 5, 2007 yes... Quote Link to comment https://forums.phpfreaks.com/topic/71959-hi-i-need-help-in-forming-a-regex-pls/#findComment-362422 Share on other sites More sharing options...
MadTechie Posted October 5, 2007 Share Posted October 5, 2007 So solved ? Quote Link to comment https://forums.phpfreaks.com/topic/71959-hi-i-need-help-in-forming-a-regex-pls/#findComment-362424 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.