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.
Further reading
- FAQ Desk: Where to find REGEX documentation ? | Notepad++ Community
- Notepad++: A guide to using regular expressions and extended search mode
- Regular Expressions Tutorial
- RegExr: Learn, Build, & Test RegEx
- regex101: Online regex tester and debugger
- RegExper: Regular Expression Visualiser