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 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] 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
Archived
This topic is now archived and is closed to further replies.