adamyork Posted February 9, 2011 Share Posted February 9, 2011 I'm only just starting to learn how to use this function, but here is my code: preg_match_all('/((?:[a-z]\w*\s?-*)+|(?:\d+))(?:\s+|$)/i',$team,$matches); As far as I know, this is looking for letters/words, numbers and white spaces. But as well as matching numbers I want it to find minus numbers. Can anyone help me alter my code correctly please? Link to comment https://forums.phpfreaks.com/topic/227165-preg_match_all-with-minus-numbers/ Share on other sites More sharing options...
JAY6390 Posted February 9, 2011 Share Posted February 9, 2011 put a - before the \d That should do it Link to comment https://forums.phpfreaks.com/topic/227165-preg_match_all-with-minus-numbers/#findComment-1171787 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.