I am trying to strip off leading 1 from a phone number in my rails app. Currently I have a params called faxnumber to equal a regular expression but i need the 1 to be stripped off
params[:faxnumber] =~ /^1\d{3}-\d{3}-\d{4}$/
1732-555-7777 i want it to be 732-555-7777
params[:faxnumber] =~ /^1\d{3}\d{3}\d{4}$/
17325557777 i want it to be 7325557777
I found a work around to that issue. but my regular expression needs some work.
right now i only need to accept numbers from the following
011 any number or amount after that is fine
732-222-3333
7325551111
1732-256-2312
17329905049
this is my regular expression which is matching everything right now that i need but it is also matching more than 10 digits for numbers such as 732333444456959 it matches part of it but i need it to match none. any help would be appreciated
(?:^011\d*)?(?:^1)?\d{3}(?:-)?\d{3}(?:-)?\d{4}$