To avoid replacing Regular expression in replaced text

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
beemavishnu
Posts: 2
Joined: Sat Jun 09, 2012 5:30 am

To avoid replacing Regular expression in replaced text

Post by beemavishnu »

Hi

I am new to Textpad regular expression. I am facing problem in generating each tags into single line.

1. My aim is to generate all required tags into single line. “ABC_12345678_� is common to all. The next part is different from each line. It can be 3 to 4 digits and single version number A to Z. Finally it should look like below.

ABC_12345678_606
ABC_12345678_9682
ABC_12345678_607
ABC_12345678_608
ABC_12345678_8415[A]
ABC_12345678_612
ABC_12345678_600[A]

2. From other tool, I will be getting as shown below

ABC_
1234567
8_606

ABC_
1234567
8_9682


ABC _
1234567
8_607

ABC _
1234567
8_608

ABC _
1234567
8_8415
[A]

ABC _
1234567
8_612


ABC _
1234567
8_600
[A]


3. Using “Find & Replace� I could able to sort out to some extent using.

"Find what: ABC_\n1234567\n8_"
"Replace with: ABC_12345678_"

But I could not able to make the version number to same line as shown below.

ABC_12345678_606
ABC_12345678_9682

ABC_12345678_607
ABC_12345678_608
ABC_12345678_8415
[A]
ABC_12345678_612

ABC_12345678_600
[A]


4. I tried to use few reqular expression. But I could not able to succeed. Even special characters are placed in replaced text.
Ex: ABC_\n12345678_[1-9][1-9][1-9][1-9]

5. How to avoid keeping regular expression in replaced text.

Please help in sorting out the tags as shown in 2 to be converted to the tags as shown in point 1.

Thanks & Regards
Vishnu Beema
ak47wong
Posts: 703
Joined: Tue Aug 12, 2003 9:37 am
Location: Sydney, Australia

Post by ak47wong »

How about this?

First, enable POSIX regular expression syntax in Configure > Preferences > Editor.

Find what: ^ABC~?_\n(1234567)\n(.*)\n [replace the ~ with a space]
Replace with: ABC_\1\2

Then to remove any remaining blank lines:

Find what: \n\n
Replace with: \n
beemavishnu
Posts: 2
Joined: Sat Jun 09, 2012 5:30 am

Post by beemavishnu »

Hi Wong,

Thank you for your comments.
Post Reply