Find and Replace by regex

View: New views
3 Messages — Rating Filter:   Alert me  

Find and Replace by regex

by calgarian :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
I am sure this has been asked before, but I couldn't find it and I'm stuck. I want to find all cases of:


digit</p>


and change them to:


digit</h2>


where digit can be any single numeric. The problem I have is that digit must be part of the find, but I can't get the replace to leave it there for me?


TIA and I'm sorry if this is repetitive.

An old mainframer getting current


_______________________________________________
Quanta mailing list
Quanta@...
https://mail.kde.org/mailman/listinfo/quanta

Re: Find and Replace by regex

by Alan Richmond :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tuesday 30 June 2009 09:33:03 am Dick Angus wrote:
> I want to find all cases of:
>
>  digit</p>
>
> and change them to:
>
> digit</h2>

Hi Dick,
The piece you are missing is what Quanta calls "placeholders" (backreferences
in PHP).

In "Find":
([\d]</)p(>)
The parenthesis tell it to put the contents in a placeholder or variable.

In "Replace With":
\1h2\2
and check "Use placeholders".
The \1 will insert the contents of the first pair of parenthesis and the \2
the second and so on.

HTH,
Alan


--
Alan Richmond
Aardwolf Networking
aardwolfweb.com
707-442-7470
_______________________________________________
Quanta mailing list
Quanta@...
https://mail.kde.org/mailman/listinfo/quanta

Re: Find and Replace by regex

by calgarian :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
> I am sure this has been asked before, but I couldn't find it and I'm stuck.
> I want to find all cases of:
>
>
> digit</p>
>
>
> and change them to:
>
>
> digit</h2>
>
>
> where digit can be any single numeric. The problem I have is that digit
> must be part of the find, but I can't get the replace to leave it there for
> me?
>
>
> TIA and I'm sorry if this is repetitive.
>
> An old mainframer getting current


Thanks Alan. Worked like a charm.

An old mainframer getting current


_______________________________________________
Quanta mailing list
Quanta@...
https://mail.kde.org/mailman/listinfo/quanta