Groovy web console

subscribe to the feed Subscribe
to this

Check Phonenumber

Published 3 months ago by RIS
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
String mobile= "079841";
def String regex = "^[0]"
def String regexTwo = "^[0]{2}"
def String regexThree = "\\+|00"

if (mobile.matches("(075|076|077|078|079).*"))
String mobileNew= mobile.replaceFirst(regex, "41");}
else if (mobile.matches("(00|\\+).*")){
String mobileNew= mobile.replaceFirst(regexThree, ""); 
return mobileNew;}
else if (mobile.matches("^(?!0)\\d.[0-9]+\$")){
return "test";}
return mobileNew = "no correct Phonenumber";