0

I can search all characters with \±*\¦ wildcard in Microsoft Word like this: ±sample word1¦ ±sample word2¦

\±*\¦ matchs entire of characters between ± and ¦ And when I want to replace ± ¦ with ( ) or any other character I use this: (^&) That returns to me as: (±sample word1¦).

Everything is ok with ms word but I have not found yet equivalent of regex for text editors (I use sublimetext and notepad++)

Please help me!

1 Answer 1

0

Notepad++ uses boost regex flavour, to match 0 or more any characters you have to use .*

  • Ctrl+H
  • Find what: ±.*?¦
  • Replace with: \($0\)
  • check Wrap around
  • check Regular expression
  • UNCHECK . matches newline
  • Replace all

Explanation:

±           # ± character, doesn't need to be escaped as it hasn't special meaning in regex
.*?         # 0 or more any character, but newline, not greedy
¦           # ¦ character, doesn't need to be escaped as it hasn't special meaning in regex. But if you use pipe `|` character then, you have to escape it: \|

Replacement:

\(          # opening parenthesis, have to be escaped in Notepad++
$0          # the whole match
\)          # closing parenthesis, have to be escaped in Notepad++

Given:

±sample word1¦ ±sample word2¦

Result for given example:

(±sample word1¦) (±sample word2¦)

Screen capture:

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .