Created
September 23, 2011 09:41
-
-
Save RichardBronosky/1237044 to your computer and use it in GitHub Desktop.
Guess that protocol...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| From: http://twitter.com/#!/datagrok/status/117094906115264513 | |
| /^(?::([^ ]+) )?([^ ]+)((?: [^: ][^ ]*){0,14})(?: :?(.*))?$/ | |
| /^ $/ | |
| match the left and right boundaries of the string (The entire string must be described by the pattern) | |
| (?::([^ ]+) )? | |
| Optional: No Back Reference*: a colon, one or more non-space chars, a space | |
| ([^ ]+) | |
| Back Reference: one or more non-space chars | |
| ((?: [^: ][^ ]*){0,14}) | |
| Back Reference: a space, one non-space non-colon char, zero or more non-space chars, all occurring 0 to 14 times, occurrences not individually back referenced | |
| (?: :?(.*))? | |
| Optional: No Back Reference*: a space, zero or one colon char, zero or more chars | |
| *The use of the "(?:" non-back referenced parenthetical groups is an optimization benefiting both performance (speed and memory requirements) and complexity of down stream code. The array of matches will not include these and the code that processes the array will not have to skip over them. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment