web analytics

Using Regular Expressions in VBScript

Options
@2016-01-17 15:20:46

Regular Expresion String - "^([0-9]{2, 3})-([0-9]{7})$"

 - ^ and $: matches at the very start and very end of the subject string;

 -  "([0-9]{2, 3})": matches the area code of an phone number , and is enclosed in brackets so that this section can be used in the replacement of the pattern ($1);

 - "-": matches hyphen;

-  "([0-9]{7})": matches 7-digit phone number, and is also enclosed in brackets so that this section can be used in the replacement of the pattern ($2);

 

Replacement String - "($1)$2"

 - "$1": references to the fist catpure above, that is the area code;

 - "$2": references to the second catpure above, that is the phone number;

 

 

Comments

You must Sign In to comment on this topic.


© 2024 Digcode.com