General questions about using TextPad
Moderators: AmigoJack , bbadmin , helios , Bob Hansen , MudGuard
SergeantRock
Posts: 5 Joined: Fri May 05, 2006 2:21 pm
Post
by SergeantRock » Fri May 05, 2006 2:29 pm
Hi.
POSIX seems to be acting up in TxtP. Alternatively, I could be making a mistake with my syntax...
Here's my XHTML:
Code: Select all
<li><a href="">shell_IE5.css</a></li>
I want to grab the first part of the filename inside the tags (before the extension) and repeat it in the href, like so:
Code: Select all
<li><a href="shell_IE5">shell_IE5.css</a></li>
My RegExp is:
I'm getting a 'Cannot find Regular Expression:'
Any ideas?
ben_josephs
Posts: 2461 Joined: Sun Mar 02, 2003 9:22 pm
Post
by ben_josephs » Fri May 05, 2006 3:06 pm
That's
non -Posix syntax (and your handling of the
> isn't quite right). You need
Fi nd what: "">([^.]+)
Rep lace with: "\1">\1
[X ] Regular e xpression
(You don't need to quote the dot in the character class, which is itself a quoting operator.)
SergeantRock
Posts: 5 Joined: Fri May 05, 2006 2:21 pm
Post
by SergeantRock » Fri May 05, 2006 3:09 pm
Thank you very much! Now I'm confused as to what's POSIX and what ain't...
But cheers for the help!
Bob Hansen
Posts: 1516 Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:
Post
by Bob Hansen » Fri May 05, 2006 3:18 pm
Search for:
Replace with:
This:
Code: Select all
<li><a href="">shell_IE5.css</a></li>
Becomes this:
Code: Select all
<li><a href="shell_IE5">shell_IE5.css</a></li>
Hope this was helpful.............good luck,
Bob
ben_josephs
Posts: 2461 Joined: Sun Mar 02, 2003 9:22 pm
Post
by ben_josephs » Fri May 05, 2006 4:09 pm
Bob Hansen wrote: Search for:
But beware of the longest-match rule. Consider what happens if there are two matching
<a> elements on one line, or, indeed, just one of them, with a dot somewhere to the right of it...
is safer.