Regular Expressions 101

Library entries

Skype/IRC log syntax highlighting

Vote

1

Regular Expression
python

"
^\s* (?: (?P<date> (?:[\[<\(]\s*)? # opening bracket (?: # date time (?: # date (?: (?: # matches mm-dd-yyyy mm-dd-yy mm-dd \d{1,2}-\d{1,2} (?: - (?:\d{4}|\d{2}) )? ) | (?: # matches mm/dd/yyyy mm/dd/yy mm/dd \d{1,2}\/\d{1,2} (?: \/ (?:\d{4}|\d{2}) )? ) ) \s+ # time \d{1,2}:\d{2} (?::\d{2})? (?: \s* (?:AM|PM) )? ) | # time date (?: # time \d{1,2}:\d{2} (?::\d{2})? (?: \s* (?:AM|PM) )? \s+ # date (?: (?: # matches mm-dd-yyyy mm-dd-yy mm-dd \d{1,2}-\d{1,2} (?: - (?:\d{4}|\d{2}) )? ) | (?: # matches mm/dd/yyyy mm/dd/yy mm/dd \d{1,2}\/\d{1,2} (?: \/ (?:\d{4}|\d{2}) )? ) ) ) | # time only (?: \d{1,2}:\d{2} (?::\d{2})? (?: \s* (?:AM|PM) )? ) ) (?:\s*[\)>\]])? # closing bracket ) \s+ )? (?P<name> (?: (?:<\s*[^\s:>]+\s*>) # match <Username> | (?:[^\s:]+:) # match Username: ) ) \s+ (?P<message>.*) $
"
gxm

Description

Loading markdown...
Submitted by Sirenfal - 5 years ago