SuperEdi

User: Guest

Search

Please use the
Bug Report Form
if you think you found a software defect.

Use the Contact Form
to send a personal message to Wolfgang.

RSS Feed RSS Feed

Other boards:
Juke
QBrowser
Raduga (English)
Song Requester

Search/replace

Posted on: SuperEdi

From Message

Michael Hanel

2007-05-30 23:15:35

Search/replace

I have stumbled across this before, but I can't find it when I need it.

I see in the replacement text I can use $1 or $2 for submatches, but how do i signify what a sub will be in the find window? I tried {} and () and neither of those seemed to have worked.

Wolfgang Loch

2007-05-31 18:49:36

Re: Search/replace

Suppose you have a text with key-value pairs like this:

aa=AA
bbb=BBB
cccc=CCCC

You can reverse keys and value using this regular expression:
Find: (\S+)=(\S+)
Replace with: $2=$1

Michael Hanel

2007-06-01 18:13:47

Re: Search/replace

I am still having some difficulty. Let me give the specific example. I want to Find:

partone.html#[0-9][0-9][0-9]">
In regular expressions I believe I have to format this with the \
partone.html\#[0-9][0-9][0-9]\"\>
Then I want to isolate everything after the .
So I thought it would be:
partone(.html\#[0-9][0-9][0-9]\"\>)

Replace: parttwo$1

But I can't get it to replace with the expected
parttwo.html#(numbers preserved)">
instead it replaces literally:
parttwo$1

Where did I err?

Wolfgang Loch

2007-06-01 21:47:07

Re: Search/replace

I have this document:

partone.html#012">
partone.html#234">
partone.html#567">

Find what: partone(\.html\#\d+">)
Replace with: parttwo$1

Works fine for me.

Which SuperEdi version and with Windows version do you use?

Michael Hanel

2007-06-01 22:18:12

Re: Search/replace

Version 4.0 U Super Edi, Windows XP

I tried your way and still got the same result that it the replace text is literally

"parttwo$1" rather than parttwo.html#012"> etc.

Sebastian Weinberg

2008-03-11 09:43:39

Re: Search/replace

I'm having the exact same problem, using SuperEdi 4.1.3U under Win XP.

If I tick the "Regular Expression" checkbox, the search will find correct matches for the expression, but any placeholders in the replacement field are inserted literally, i.e. as "$1", "$2", etc.

Wolfgang Loch

2008-04-02 20:44:04

Re: Search/replace

Did you use "Replace" or "Replace All"? The placeholders only work in "Replace All" mode.

That's because the "Replace" button simply replaces the current selection no matter if it matches the search term or not.

Sebastian Weinberg

2008-04-06 09:38:23

Re: Search/replace

Ah, that's it. I was using the "Replace" button first, to see whether I had gotten the regular expression and replacement string right, and since that didn't work as I expected, I never used "Replace All".

Thanks!

Post a reply to this message: