JChilds Posted September 12, 2011 Share Posted September 12, 2011 I have a file with id_12345 randomtext id_987459768 This code gets me 'id_12345' but I only want it to return 12345 Is this possible? /id_[1-9]?\d+/g Quote Link to comment https://forums.phpfreaks.com/topic/246945-only-select-part-of-preg_match/ Share on other sites More sharing options...
xyph Posted September 12, 2011 Share Posted September 12, 2011 /id_([1-9]++)/ Then use $match[1] Quote Link to comment https://forums.phpfreaks.com/topic/246945-only-select-part-of-preg_match/#findComment-1268231 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.