0

I rarely use regular expressions, but I have a task at work that needs to be done quickly.

I'm using notepad++ to search through a directory containing a lot of sql scripts.

I need to search for 2 consecutive words that are separated by white space(s), tab or newline, and has white space(s), tab or newline immediately before and after it:

1)

set mgtfee [ Should Match ]

2)

set
mgtfee [ Should Match ]

I tried the following but it did Not work

(\w|^)set\mgtfee(\w|$)
1
  • Please edit and give some proper examples of text that should match and text that shouldn't. I suspect your current specification is too broad and is going to give you a lot of false positives as it will match any two consecutive words anywhere in any file.
    – DavidPostill
    Mar 14 '19 at 13:34
1

Have a try with:

  • Find what: \s*set\s+mgtfee\s*
2
  • I believe that this is wrong.  Remember that * matches zero or more characters, so this would match "setmgtfee".
    – Scott
    Mar 14 '19 at 15:28
  • @Scott: You're right, fixed.
    – Toto
    Mar 14 '19 at 15:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.