Difference between revisions of "Regular Expression Cheat Sheet"
Jump to navigation
Jump to search
VeeralShah (talk | contribs) |
|||
Line 13: | Line 13: | ||
+ 1 or more times | + 1 or more times | ||
? 0 or once | ? 0 or once | ||
− | \s | + | \s any whtespace character |
\d number | \d number | ||
+ | \w any alphanumeric | ||
+ | \W any non-alphanumeric | ||
[0-9] any number (once) | [0-9] any number (once) | ||
[a-z] any letter (once) | [a-z] any letter (once) | ||
Line 24: | Line 26: | ||
() captures whatever is in the bracktets | () captures whatever is in the bracktets | ||
\ escape the next thing (e.g. \} matches }) | \ escape the next thing (e.g. \} matches }) | ||
− | + | [^...] not whatever (...) | |
==Lex Machina== | ==Lex Machina== |
Revision as of 12:32, 28 June 2017
This is a page for regular expression hacks. Chronicle your exploits so that others can benefit from your ingenuity!
Useful RegExes
Pattern Matches ------------------ \t tab \n newline ^ start of line $ end of line . any character * any number of times + 1 or more times ? 0 or once \s any whtespace character \d number \w any alphanumeric \W any non-alphanumeric [0-9] any number (once) [a-z] any letter (once) [a-Z] any letter (case insensitive] abc abc [a|b|c] a or b or c {1,3} 1, 2, or 3 times in a row {3,} 3 or more times () captures whatever is in the bracktets \ escape the next thing (e.g. \} matches }) [^...] not whatever (...)
Lex Machina
Task
Use Patent Portfolio Report to pull unique patent numbers for patents litigated in 2015
Steps Taken
- Filtered Lex Machina until total patents were under 2000.
- Lex Machina ran its Patent Portfolio Report
- Ctrl-A to select all, then pasted into TextPad
- Patent numbers were the first word in every line
- Used replace command (F8) to find "(^.+?)\s.*$" and replace with "\1"
- Make sure "regular expression" is checked
- That left only the patent numbers
- Repeated above steps until all 2015 patents are in TextPad
- Exported data to Excel and then Removed Duplicates (Data --> Remove Duplicates)