weird Replace results...

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
cow
Posts: 3
Joined: Thu May 08, 2003 6:00 pm
Location: nevada, usa

weird Replace results...

Post by cow »

I'm trying to insert a single line in about 50 HTML files but I'm getting weird results when I use the Replace All command.

I'm trying to change this:
<li>&nbsp;<a href="/courses.html">Courses</a></li>

To this:
<li>&nbsp;<a href="/courses.html">Courses</a></li>
<li>&nbsp;<a href="/prizes.html">Prizes</a></li>

Using this in the Replace command (Conditions: Text, Regular Expression; Scope: Active document):
Find what: <li>&nbsp;<a href="/courses.html">Courses</a></li>\n
Replace with: <li>&nbsp;<a href="/courses.html">Courses</a></li>\n<li>&nbsp;<a href="/prizes.html">Prizes</a></li>

I get this when I click the Replace All button:
<li><li>&nbsp;<a href="/courses.html">Courses</a></li>
nbsp;<a href="/courses.html">Courses</a></li>
<li><li>&nbsp;<a href="/courses.html">Courses</a></li>
nbsp;<a href="/prizes.html">Prizes</a></li>

I've used the Replace command many times with &nbsp; and I've never had any problems. Any ideas?!?
-----
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

When you're using regular expressions, an & in the replacement expression represents the entire matched expression. Use \&.
Post Reply