Sponsored link:
Windows grep software to search (and replace) through files and folders on your PC and network
Windows grep software to search (and replace) through files and folders on your PC and network

 

Regular Expressions

Sample expressions:

 

Regular Expressions
Function Regular Expression Back reference Description Remarks
Simple date \b(\d?\d[-\/]\d?\d[-\/](\d\d)?\d\d)\b \1 Match date within a text Will match 99/99/9999 (or 99-99-9999)
Simple time \b(\d?\d:\d\d(:\d\d(\.\d+)?)?)\b \1 Match time within a text Will match 99:99:99.999
Simple HTML tag (<[^>]+>) \1 Match any tag within HTML code Will fail on <IMG src="fastforward.gif" ALT=">>">
HTML tag with text (<[^>]+>([^<]+<\/[^>]+>)?) \1 Match either single tag only or "tag set" including "embedded text" Will also fail on <IMG src="fastforward.gif" ALT=">>"> and on nested HTML tags, as in <B><I>text</I></B>
Simple IP address \b((\d{1,3}\.){3}\d{1,3})\b \1 Match an IP address within a text Will match 999.999.999.999
IP address \b(([0-2]?\d{1,2}\.){3}[0-2]?\d{1,2})\b \1 Match an IP address within a text Will still match 299.299.299.299
True IP address \b((([01]?[0-9]{1,2}|2([0-4][0-9]|5[0-5]))\.){3}([01]?[0-9]{1,2}|2([0-4][0-9]|5[0-5])))\b \1 Match an IP address within a text Will only match valid IP addresses