Search for lines and replace using regular expression

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
hotkee
Posts: 2
Joined: Sun Jul 05, 2009 10:43 am

Search for lines and replace using regular expression

Post by hotkee »

Example line below

<item>Some Title text
<item>Some Different Title text

I would like to be able to search for all text like above and replace with

<item>Some Title Text<code>
<item>Some Different Title text<code>

Sounds simple - I can do a search using regular expression

<item>.*

That finds the lines, but when I try to do a replace using replace string

<item>.*<code>

I get

<item>.*<code>
<item>.*<code>

Cant figure it out so hope someone can help - TIA
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Find what: <item>.*
Replace with: \0<code>

[X] Regular expression
Look in TextPad's help under
Reference Information | Regular Expressions,
Reference Information | Replacement Expressions and
How to... | Find and Replace Text | Use Regular Expressions.
hotkee
Posts: 2
Joined: Sun Jul 05, 2009 10:43 am

thanks

Post by hotkee »

Excellent - thanks for reply.
Post Reply