Difference between revisions of "Regex syntax"
Jump to navigation
Jump to search
(less) |
|||
Line 9: | Line 9: | ||
! sed (GNU) | ! sed (GNU) | ||
! vim | ! vim | ||
− | ! less | + | ! less (GNU) |
! python | ! python | ||
|+ | |+ |
Revision as of 08:00, 20 May 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 | less (GNU) | python | |
---|---|---|---|---|---|
capture | \( ... \) | \( ... \) | \( ... \) | ( ... ) | ( ... ) |
option | \| | \| | \| | | | | |
word boundary | \< or \> | \< or \> | \< or \> | \< or \> | \b |
zero or one | \? | \? | \? | ? | ? |
zero or more | * | * | * | * | * |
zero or more (non-greedy) | \{-} | (unknown) | *? | ||
one or more | \+ | \+ | \+ | + | |
one or more (non-greedy) | \{-1,} | (unknown) | +? |