Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save juliendargelos/d0587e748905079f82f761080655b616 to your computer and use it in GitHub Desktop.

Select an option

Save juliendargelos/d0587e748905079f82f761080655b616 to your computer and use it in GitHub Desktop.
How to specify regex flags in sublime text search bar

Based on this answer from @kingkeith on the sublime text forum (thanks).

When using regular expressions to search within sublime text, flags can be specified by adding (?MY_FLAGS) at the beggining of the expression.

Example:

(?s)pattern with dots also matching new lines

Default flags can be removed by adding - before the flag letter:

(?-m)^pattern matching the whole file$

The default flags are:

  • g: match more than once (cannot be removed)
  • m: ^ and $ match the beginning and end of lines, respectively
  • i: depends on the case sensitive toggle state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment