Here is the problem. I have thousands of lines like that below.
I want to replace text "type1" with something else. But in specific way.
for example,
when the line have "$atom:C" and "$atom:C" replace "type1" with "some text".
when the line have "$atom:C" and "$atom:H" replace "type1" with "some another text".
when the line have "$atom:C" and "$atom:N" replace "type1" with "another text".
(numbers at the end of the "$atom:C1" should be ignored. Here it says "C1" but only "C" is important for me)
$bond:id1 @bond:type1 $atom:C1 $atom:C2
$bond:id2 @bond:type1 $atom:C1 $atom:C3
$bond:id3 @bond:type1 $atom:C1 $atom:H1
$bond:id4 @bond:type1 $atom:C1 $atom:H2
$bond:id5 @bond:type1 $atom:C2 $atom:N1
$bond:id6 @bond:type1 $atom:C2 $atom:H4
$bond:id7 @bond:type1 $atom:C2 $atom:H3
$bond:id8 @bond:type1 $atom:C3 $atom:O1
>Solution :
You can work with regex and capturing groups.
You can for each of your conditions build a regex and capture the atom parts and then replace it by your some text + the group you just captured.
As you can see here I created a regex for your first condition, so in notepad++ you can just set in the Find box:
type1 (\$atom:C\d \$atom:C\d)
which will find type1 followed by twice $atom:C_digit, where _digit is a digit after the C. It will capture this pattern of double $atom:C_digit and so you can use it in your replace with box:
some text ($1)
Where the ($1) will replace it with what was captured.
Make sure to check the regular expression box in the replace window in notepad++.
You can create such a logic for the remaining replacings as well.
