+ 2

Some regex help please

Can someone give me a regex string in java That will be matched by phone numbers of format 000.000.0000 and 000-000-0000 alone

15th Mar 2019, 7:36 PM
Mind To Machine 💻🕆
Mind To Machine 💻🕆 - avatar
2 odpowiedzi
+ 2
Pete Wright your program is wonderful, i was just trying to see how others will approach the problem Check my program out and make sure you read the comments https://code.sololearn.com/cGNrrd7lTVI6/?ref=app
16th Mar 2019, 1:24 AM
Mind To Machine 💻🕆
Mind To Machine 💻🕆 - avatar
0
Mind To Machine 💻🕆 I am not sure about the Java Syntax but the Regex pattern should look like this one: /^(\d{3}[-]{1}\d{3}[-]{1}\d{4}|\d{3}[\.]{1}\d{3}[\.]{1}\d{4})$/gi Check my code: https://code.sololearn.com/WP5NgJbhE7KM/?ref=app
16th Mar 2019, 1:19 AM
Pete Wright
Pete Wright - avatar