Page 2 of 2

Posted: Sun Apr 14, 2013 6:20 pm
by geoffreykidd
Thank you.

Posted: Mon Apr 15, 2013 10:15 am
by ben_josephs
Please try this instead:
(?!^([^“�\r\n]++|“[^“�\r\n]*�)*$)^.+
which puts less of a strain on the recogniser.

Posted: Mon Apr 15, 2013 3:46 pm
by geoffreykidd
The revised RegEx worked beautifully. If I could possibly thank you enough, I would.

Posted: Mon Apr 15, 2013 5:56 pm
by ben_josephs
You're welcome. We're co-operating to give this new version a really good work-out. :-)

Posted: Mon Apr 15, 2013 6:17 pm
by geoffreykidd
One interesting note about the new RegEx. It works beautifully in 7.0.0,
but when I put it into RegEx Buddy with the PERL setting, I got back out a message: Perl does not support possessive quantifiers «+»

For the second "+" in the "++" sequence. It still worked in TextPad 7, though.

Posted: Mon Apr 15, 2013 8:12 pm
by ben_josephs
Possessive quantifiers were introduced into Perl in version 5.10, released in 2007.

What does RegEx Buddy have to say about this version:
(?!^(?>[^“�\r\n]+|“[^“�\r\n]*�)*$)^.+
which uses an "independent subexpression", which is what lies behind a possessive quantifier and stops backtracking?

Posted: Tue Apr 16, 2013 10:13 pm
by geoffreykidd
It passed RegEx Buddy in Perl mode with flying colors. I also just tried it on the earlier file that caused problems and a new text I just received. It worked beautifully in both cases.

Thank you.

Posted: Wed Apr 17, 2013 10:45 pm
by geoffreykidd
I checked the latest RegEx out in 7.0.4. No problems.

Straight Quotes RegEx?

Posted: Thu May 08, 2014 6:23 pm
by geoffreykidd
I've discovered I need to do the same gig as for curly quotes with straight quotes. Any suggestions? BTW, the curly quote regex is backed up on my systems. I occasionally look at it and mutter "My precious." :)

Posted: Thu May 08, 2014 7:17 pm
by ben_josephs
Do you mean you want to find all lines that contain an odd number of straight quotes?

The obvious alteration to my previous suggestion will do that:
(?!^([^"\r\n]++|"[^"\r\n]*")*$)^.+

As will:
(?!^[^"\r\n]+(?:"[^"\r\n]*"[^"\r\n]*)*$)^.+

Posted: Thu May 08, 2014 7:25 pm
by geoffreykidd
The alteration wasn't obvious to me, I'm afraid. I can do a few things with regular expressions, RegEx 101 level. This stuff seems to be a lot higher level.

A thousand thanks.