Prismatic Posted December 13, 2008 Share Posted December 13, 2008 How would one go about matching the following in a string? (xxxx/yyyy) basically find anything inside a pair of quotes ( ) with a / in the middle so in this example: dfasdf asfasd : dsfasd asdfasd -.-- fhfg (40.34342/5.023424) asdf 40.34342 and 5.023424 would be matched? Solved (\s\((.*?)/(.*?)\)\s) Link to comment https://forums.phpfreaks.com/topic/136798-solved-will-trade-cookies-for-regex-help/ Share on other sites More sharing options...
DarkWater Posted December 13, 2008 Share Posted December 13, 2008 I'm surprised that that is working. I'd have suggested: !\(.+?/[^)]+\)!s Link to comment https://forums.phpfreaks.com/topic/136798-solved-will-trade-cookies-for-regex-help/#findComment-714631 Share on other sites More sharing options...
nrg_alpha Posted December 14, 2008 Share Posted December 14, 2008 I'm surprised that that is working. I'd have suggested: !\(.+?/[^)]+\)!s Alternatively, it could be simplified as such: #\([^)]+\)#s Link to comment https://forums.phpfreaks.com/topic/136798-solved-will-trade-cookies-for-regex-help/#findComment-715262 Share on other sites More sharing options...
DarkWater Posted December 15, 2008 Share Posted December 15, 2008 He needs a / in the middle. Link to comment https://forums.phpfreaks.com/topic/136798-solved-will-trade-cookies-for-regex-help/#findComment-715491 Share on other sites More sharing options...
nrg_alpha Posted December 15, 2008 Share Posted December 15, 2008 He needs a / in the middle. Oops, my bad. Must have fallen asleep at the keyboard.. Link to comment https://forums.phpfreaks.com/topic/136798-solved-will-trade-cookies-for-regex-help/#findComment-715517 Share on other sites More sharing options...
DarkWater Posted December 15, 2008 Share Posted December 15, 2008 Actually, let me rewrite it so you get the matches grouped how you wanted: !\((.+?)/([^)]+)\)!s Link to comment https://forums.phpfreaks.com/topic/136798-solved-will-trade-cookies-for-regex-help/#findComment-715521 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.