Regex to match just exact words Notepad++

notepadregex

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".

Best 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

Related Question