Search code examples
regexnotepad++sublimetext3wildcardboost-regex

Retaining Text in Find Replace in Sublime Text


I have strings as follows

  • 5V6A 6Q2A 6Q 5Q
  • FA 7A EQ2A 799Q
  • M Y77A279791
  • V59 2 5A266
  • Q7Q E7Q 7 7AQ2A 7A29

I identify them using following in Find Option

\w.+\d.+(\w+( |$))+

My problem is that I want to replace it with same, but add a "@" symbol afterwards. I want find-replace in Sublime Text / Notepad++. I want to retain what I find, replace with same, but with a "@" at the end of it. So at the end, I want it to be as follows after replacement.

  • 5V6A 6Q2A 6Q 5Q @
  • FA 7A EQ2A 799Q @
  • M Y77A279791 @
  • V59 2 5A266 @
  • Q7Q E7Q 7 7AQ2A 7A29 @

Please help with replace.

Example of Data I want to find them in

5V6A 6Q2A 6Q 5Q
Ms.Elena O Peery
Abell (Baltimore)
$Six Million  One Hundred Thirty Thousand Seven Hundred Thirty Nine AND Twenty Six%
Twenty Nine Years AND Seven.One%
(Purchase Value Reduction 16.47%)
(Monthly Principal Reduction 7.59%)
(Total Interest Reduction 17.81%) 
Mr. Guy L Pittman   
E97 99A2A 7Q 9A2999Q

 Q5A2A5 6 6A 5 767Q 
 Mrs.Margaret E No Lents
 Juction(Portland) 
 $Seven Million Nine Hundred Eighty Six Thousand Three Hundred Twenty Three     AND Seventeen%
 Seventeen Years AND Seven.Eight%
(Purchase Value Reduction 2018%)
(Monthly Principal Reduction 1036%)
(Total Interest Reduction 14.87%) 
Ms.Edna R Messerly 
7A2YA2AQ27A 7A27AQ2

Solution

  • Just posting it as an answer to mark the question solved.

    I still don't get the criteria for making up the regex but if your regex works fine then search for (\w.+\d.+(\w+( |$))+) and replace with \1 @ in notepad++