Page 1 of 1

POSIX seems not to be working...

Posted: Fri May 05, 2006 2:29 pm
by SergeantRock
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:

Code: Select all

Find: ""\(>[^\.]+\)

Code: Select all

Replace: "\1"\1
I'm getting a 'Cannot find Regular Expression:'

Any ideas?

Posted: Fri May 05, 2006 3:06 pm
by ben_josephs
That's non-Posix syntax (and your handling of the > isn't quite right). You need
Find what: "">([^.]+)
Replace with: "\1">\1

[X] Regular expression
(You don't need to quote the dot in the character class, which is itself a quoting operator.)

Posted: Fri May 05, 2006 3:09 pm
by SergeantRock
Thank you very much! Now I'm confused as to what's POSIX and what ain't...
But cheers for the help!

Posted: Fri May 05, 2006 3:18 pm
by Bob Hansen
Search for:

Code: Select all

(.*=")(">)(.*)\.
Replace with:

Code: Select all

\1\3\2\3\.
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>

Posted: Fri May 05, 2006 4:09 pm
by ben_josephs
Bob Hansen wrote:Search for:

Code: Select all

(.*=")(">)(.*)\.
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...

Code: Select all

(=")(">)([^.<]*)\.
is safer.