Hello, I'm a beginner in regex. Basically, what I want is to match a specified number of integers in a string. Like, :
$str="123-456-789" // phone number...
I want to check, via preg_match(), whether the string contains [7-15] digits. So, 123-456-789-321-654 would be valid; they contain 20 characters, but only 15 digits, so it's within the interval range.
I thought about validating the string then stripping out the hyphens/spaces then count the final filtered version of the string. But I'd rather do them all in one regex pattern. Is there a way to do that?
If it wasn't clear enough, please tell which part wasn't. Thanks.