Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
文字列から次の形式の電話番号を削除するにはどうすればよいですか?
xxx-xxxxxxx または xxx-xxx-xxxx または xxxxxxxxxx
ここで、x は任意の数です。
これは役立つはずです:
var myRegex = new Regex(@"((\d){3}-1234567)|((\d){3}\-(\d){3}\-4567)|((\d){3}1234567)"); string newStringWithoutPhoneNumbers = myRegex.Replace("oldStringWithPhoneNumbers", string.Empty);