Is this possible? (Regular expressions)

General discussions about Advanced Find and Replace
Post Reply
transient
Posts: 2
Joined: Wed May 04, 2005 8:50 pm

Is this possible? (Regular expressions)

Post by transient » Wed May 04, 2005 9:21 pm

I've been trying without any success to get the following operation to work:

find: phantom1234{Backspace}{Backspace}{Backspace}{Backspace}

replace to: phantom

I'm beginning to think thas's not possible to be done so I decided to post here. I'll buy this software if I can get it to work


peace

Abacre
Site Admin
Posts: 1198
Joined: Mon Jan 31, 2005 5:32 pm
Contact:

Post by Abacre » Wed May 04, 2005 9:48 pm

Hi,

I suppose that it's not Backspace but it's new line. Isn't it?
In fact if you used Replace operation: AFR removes trailing spaces by
default. So instead of
find: phantom1234{Backspace}{Backspace}{Backspace}{Backspace}
it was considered as phantom1234
In order to switch off this "feature" go to main menu - Action -
Options - Replace and uncheck "Remove trailing spaces".
But then you have to be sure about how many trailing spaces do you
have.

Second, maybe more reliable variant:
use Batch replace
so go to Batch replace tab and check ON: "Use regular expressions"
then put into search for:
phantom1234\r\n\r\n\r\n\r\n
and into replace with:
phantom

so in Windows \r\n\ is used as return and new line chars.

Does it work now?
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

transient
Posts: 2
Joined: Wed May 04, 2005 8:50 pm

Post by transient » Wed May 04, 2005 10:34 pm

Roman wrote:I suppose that it's not Backspace but it's new line. Isn't it?


nope, that's what the actual text looks like, namely this:

"phantom1234{Backspace}{Backspace}{Backspace}{Backspace}"

what I'm trying to do is to get the program to delete the {Backspace} strings and one character immediately preceding it. The closest I came to getting it right was to type this into the batch replace:

search for: \S{Backspace}
replace with: (this field I just leave blank)

then if I have this:

phantom1{Backspace}

I'll end up with this:

phantom

which is precisely what I want to do. The problem arises when I have more then one {Backspace} in sequence. When I have this:

phantom1234{Backspace}{Backspace}{Backspace}{Backspace}

I'll end up with this:

phantom123{Backspace{Backspace}

the final text needs to be the word phantom.. Any ideas?

Abacre
Site Admin
Posts: 1198
Joined: Mon Jan 31, 2005 5:32 pm
Contact:

Post by Abacre » Fri May 06, 2005 11:35 pm

Try this:

Search for:
phantom\d+\{[\{\}\w]+Backspace\}

Replace with:
phantom

Modifier S: OFF
Modifier G: ON

I verified it works perfectly.
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests