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? Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.