How to find/replace from point1 to point2

General questions about using TextPad

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

Post Reply
steve1040
Posts: 39
Joined: Fri Oct 13, 2006 2:19 am

How to find/replace from point1 to point2

Post by steve1040 »

My string looks like this

XXX1 Submited By Francis 2 ( xxxxxx @ hotmail . com ) XXX2
XXX1 Submited By Francis 1 ( xxcxxx @ gmail . com ) XXX3

I can find Submited By but how do I select up to )

I'd like to be left with
XXX1*XXX2
XXX1*XXX3

THanks
Steve
User avatar
SteveH
Posts: 327
Joined: Thu Apr 03, 2003 11:37 am
Location: Edinburgh, Scotland
Contact:

Post by SteveH »

Find what:
Submited By.*)
With regular expression enabled and POSIX regular expression syntax enabled in the general preferences.

Please note there is a space in front of 'Submited By'. The '.' character indicates find any character and the '*' means repeated zero or more times and then the search strings ends on the ')'

There are other ways to do this but this seems to fit in with the search you've already described.

I wasn't sure whether your 'X' and '*' characters indicated variable content here.

Hope this helps.
Running TextPad 5.4 on Windows XP SP3 and on OS X 10.7 under VMWare or Crossover.
steve1040
Posts: 39
Joined: Fri Oct 13, 2006 2:19 am

Post by steve1040 »

SteveH wrote:Find what:
Submited By.*)
With regular expression enabled and POSIX regular expression syntax enabled in the general preferences.

Please note there is a space in front of 'Submited By'. The '.' character indicates find any character and the '*' means repeated zero or more times and then the search strings ends on the ')'

There are other ways to do this but this seems to fit in with the search you've already described.

I wasn't sure whether your 'X' and '*' characters indicated variable content here.

Hope this helps.
Thanks
That is what I needed - for some reason I thought ) was a reserved character.
User avatar
Bob Hansen
Posts: 1517
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

Search for: ^(XXX1).*(XXX[0-9])$
Replace with: \1*\2

Converts from this:
XXX1 Submited By Francis 2 ( xxxxxx @ hotmail . com ) XXX2
XXX1 Submited By Francis 1 ( xxcxxx @ gmail . com ) XXX3

To this:
XXX1*XXX2
XXX1*XXX3



Use the following settings:
-----------------------------------------
[X] Regular expression
Replace All
-----------------------------------------
Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
-----------------------------------------
Hope this was helpful.............good luck,
Bob
Post Reply