Regex to match just exact words Notepad++

What would be the regular expression to find exact words, while excluding compounded words that contain the searched string.

For example I would like to match the string "wood floor" in "best wood floor" but not "hardwood floor", "hardwood flooring" "best hardwood floor".

1 Answer

What is the regular expression to find exact words, excluding compounded words?

I would like to match the string "wood floor" in "best wood floor" but not "hardwood floor", "hardwood flooring" "best hardwood floor".

  • Menu "Search" > "Find" (or Ctrl+F)

  • Set "Find what" to \<wood floor\>

  • Enable "Regular expression".

  • Click "Find Next" or "Find All in Current Document".

Notes:

  • \< matches the start of a word using Scintilla's definitions of words.
  • \> matches the end of a word using Scintilla's definition of words.

enter image description here


Further reading

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like