Skip to content

Instantly share code, notes, and snippets.

@avbelyaev
Last active April 16, 2021 12:37
Show Gist options
  • Save avbelyaev/8e9d410a544d095c67c5c2f4bbedb9cb to your computer and use it in GitHub Desktop.
Save avbelyaev/8e9d410a544d095c67c5c2f4bbedb9cb to your computer and use it in GitHub Desktop.
neg lookahead regex
(?!\s\d\sмес)(\s\d\s)

neg. lookahead ?!xxx should match everything but xxx

thus in the below, 4 мес should not match

фывыфлоол 3 Каша ылвоаыд ывлдао 4 мес еукфывфыв 4 мышвофы 6 ыф 7 ajsdas 

а вот 3 каша, 4 мышвофы, 6 ыф и 7 ajsdas - должен заматчить

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment