replace characters in notepad++ BUT exclude characters inside single quotation marks(2nd)

后端 未结 1 588
青春惊慌失措
青春惊慌失措 2020-12-22 01:51

replace characters in notepad++ BUT exclude characters inside single quotation marks

Sorry to all users (especially to Avinash Raj) who answered already 1st simi

相关标签:
1条回答
  • 2020-12-22 02:15

    Could combine a recursive part for getting '... '.... abc '' and use \K for resetting after. This is the part that needs to be skipped. And using kind of the trick, matching remaining words in pipe:

    '\s*(?0)?[^']*'\K|(\w+)
    
    • (?0)? here the pattern is optionally pasted from start
    • \s is a shorthand for whitespace character [ \t\r\n\f]
    • \w is a short for word character [A-Za-z0-9_]

    And replace with \L\1 to lower words captured inside the first capture group or \U\1 to upper.
    Works for me in NP++ 6.7.9.2 with your sample data. See regex101 for testing the pattern.

    0 讨论(0)
提交回复
热议问题