jd2007 Posted October 9, 2007 Share Posted October 9, 2007 this is the regex: |(\\(.*?\\))| this is the string : (xy)aaa(ab)hh Quote Link to comment https://forums.phpfreaks.com/topic/72465-how-to-modify-the-regex-below-to-get-match-the-first-braces-in-the-string/ Share on other sites More sharing options...
MadTechie Posted October 9, 2007 Share Posted October 9, 2007 wrong section but here <?php if (preg_match('/(\(.*?\))/i', $data, $regs)) { $result = $regs[1]; } else { $result = ""; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/72465-how-to-modify-the-regex-below-to-get-match-the-first-braces-in-the-string/#findComment-365385 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.