Page 1 of 1

How to find/replace from point1 to point2

Posted: Wed Jan 27, 2010 12:12 pm
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

Posted: Wed Jan 27, 2010 12:27 pm
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.

Posted: Wed Jan 27, 2010 12:55 pm
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.

Posted: Wed Jan 27, 2010 1:40 pm
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
-----------------------------------------