I'm trying to remove / detect phone numbers from messages between users of my marketplace website (think eBay does something similar) this is the code I'm using:
$string = preg_replace('/([0-9]+[\- ]?[0-9]+)/', '', $string);
BUT... it's too aggressive and it does strip away any number with 2 or more numerals... how can set a limit of say 7 numbers instead?
to be more precise the phone numbers can be any format like
3747657654
374-7657654
374-765-7654
(374)765-7654
etc...(i cannot predict what the users will write depending of their habits)
i cannot predict what the users will write depending of their habitsHow will you figure out difference between 7 digit phone# and 7 digit money e.g.1234567?