How to find the following time string in a text file?
(09:00 -12:00)
Try regular expression:
\((\d{1,2}:\d{1,2}.*\d{1,2}:\w*)\)
Imagine you are trying to remove the time from this sting "meet up with friends (09:00 - 12:00)"
Code:
string result = System.Text.RegularExpressions.Regex.Replace("meet up with friends (09:00 - 12:00)", @"\((\d{1,2}:\d{1,2}.*\d{1,2}:\w*)\)",string.Empty)
Result:
result = "meet up with friends" is produced.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment