Skip to content

Instantly share code, notes, and snippets.

@abhinavkorpal
Last active July 21, 2017 06:36
Show Gist options
  • Save abhinavkorpal/0c1ac9bf4f8ec86c01a4fb40062f29fb to your computer and use it in GitHub Desktop.
Save abhinavkorpal/0c1ac9bf4f8ec86c01a4fb40062f29fb to your computer and use it in GitHub Desktop.
A regular expression may be followed by one of several repetition operators:
‘.’ The period ‘.’ matches any single character.
‘?’ The preceding item is optional and will be matched at most once.
‘*’ The preceding item will be matched zero or more times.
‘+’ The preceding item will be matched one or more times.
‘{n}’ The preceding item is matched exactly n times.
‘{n,}’ The preceding item is matched n or more times.
‘{,m}’ The preceding item is matched at most m times. This is a GNU extension.
‘{n,m}’ The preceding item is matched at least n times, but not more than m times.
‘]’ ends the bracket expression if it’s not the first list item. So, if you want to make
the ‘]’ character a list item, you must put it first.
‘[.’ represents the open collating symbol.
‘.]’ represents the close collating symbol.
‘[=’ represents the open equivalence class.
‘=]’ represents the close equivalence class.
‘[:’ represents the open character class symbol, and should be followed by a valid
character class name.
‘:]’ represents the close character class symbol.
‘-’ represents the range if it’s not first or last in a list or the ending point of a
range.
‘^’ represents the characters not in the list. If you want to make the ‘^’ character
a list item, place it anywhere but first.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment