Skip to content

Instantly share code, notes, and snippets.

@David263
Last active July 20, 2022 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save David263/0da28904dbb173049af466f26f7a749a to your computer and use it in GitHub Desktop.
Save David263/0da28904dbb173049af466f26f7a749a to your computer and use it in GitHub Desktop.
How to write a regular expression/regex to recognize your own definition of a word
Let's say you want your word to be an identifier containing a letter, digit, hyphen, period, or minus sign. It is this easy:
[a+-zA-Z0-9._-]?!([a+-zA-Z0-9._-])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment