Regex syntax: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
No edit summary |
(add references) |
||
| Line 53: | Line 53: | ||
| <tt>+?</tt> |
| <tt>+?</tt> |
||
|} |
|} |
||
== References == |
|||
* https://www.gnu.org/software/grep/manual/html_node/Regular-Expressions.html |
|||
* http://vimregex.com/ |
|||
* https://docs.python.org/3/library/re.html |
|||
[[Category:Programming]] |
[[Category:Programming]] |
||
Revision as of 13:58, 18 April 2020
- This article is currently a stub; it means I'm aware it's short and I probably intend to expand on the subject in the future!
I can never remember which programs use which regex variants, so here's a quick recap sheet.
| grep (GNU) | sed (GNU) | vim | python | |
|---|---|---|---|---|
| capture | \( ... \) | \( ... \) | \( ... \) | ( ... ) |
| option | \| | \| | \| | | |
| word boundary | \< or \> | \< or \> | \< or \> | \b |
| zero or more | * | * | * | * |
| zero or more (non-greedy) | \{-} | *? | ||
| one or more | \+ | \+ | \+ | + |
| one or more (non-greedy) | \{-1,} | +? |