Saturday, 15 January 2011

regex - C# Remove Phone Number from String? -



regex - C# Remove Phone Number from String? -

how remove phone number in next format string?

xxx-xxxxxxx or xxx-xxx-xxxx or xxxxxxxxxx

where x number.

this should help:

var myregex = new regex(@"((\d){3}-1234567)|((\d){3}\-(\d){3}\-4567)|((\d){3}1234567)"); string newstringwithoutphonenumbers = myregex.replace("oldstringwithphonenumbers", string.empty);

c# regex string

No comments:

Post a Comment