
Coderifous
journeyman
Feb 12, 2002, 12:02 PM
Views: 29831
|
|
Re: [unknownSym] Phone Number Input Fix Golf
|
|
|
Uh oh. Houston, we have a problem. Given input with non-digit characters in between digit groups, it doesn't function properly: 111-222-4444 becomes: 111-222-4444 Becuase that \D* is matching "0 or more characters that are not-digits" So when it reaches the first digit, it has satisfied the match. Solution: Take away the * and add the repitition modifier: s/\D//g;s/(\d{3})(\d{3})/($1) $2-/;print; Voila! But the credit still goes to Sym --Jim
(This post was edited by Coderifous on Feb 12, 2002, 12:03 PM)
|