why doesn't \(\r\n\)\{3,\} match
but this \(a\)\{3,\} does?
how would I get \(\r\n\)\{3,\} to work?
I see + is recognized, so wouldn't that be POSIX ERE? Why does it act like POSIX BRE for escaping ( ) and { } ? and ERE in having +. Is there a name for this if it's not posix BRE or ERE?
i'm using textpad v5
why does this work, why doesn't this work?n is it BREorERE?
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
There are two unrelated issues here.
1. \(\r\n\)\{3,\} -- or (\r\n){3,} using "Posix" syntax -- doesn't work for two reasons:
a. TextPad's regex recogniser never sees a carriage return: TextPad handles all line endings (LF, CR or CR-LF) in the same way, and \n matches any of them. \r doesn't match a CR; it matches a plain r.
b. TextPad's regex recogniser doesn't allow a \n to be quantified with * or + or {m,n}, or to be contained in a parenthesised expression. So you can't match an arbitrary number of newlines.
2. TextPad's use of the tem "Posix" in the context of regular expressions is incorrect. It merely refers to the use of the symbols (, ), |, { and } as operators when they stand alone and as literals when the are escaped with backslashes, rather than the other way round. The same engine underlies both syntactic styles. This engine supports +, even though Posix BREs (basic regular expressions) don't.
1. \(\r\n\)\{3,\} -- or (\r\n){3,} using "Posix" syntax -- doesn't work for two reasons:
a. TextPad's regex recogniser never sees a carriage return: TextPad handles all line endings (LF, CR or CR-LF) in the same way, and \n matches any of them. \r doesn't match a CR; it matches a plain r.
b. TextPad's regex recogniser doesn't allow a \n to be quantified with * or + or {m,n}, or to be contained in a parenthesised expression. So you can't match an arbitrary number of newlines.
2. TextPad's use of the tem "Posix" in the context of regular expressions is incorrect. It merely refers to the use of the symbols (, ), |, { and } as operators when they stand alone and as literals when the are escaped with backslashes, rather than the other way round. The same engine underlies both syntactic styles. This engine supports +, even though Posix BREs (basic regular expressions) don't.
ta.. one point though..
(a) matches (a)
\(a\) matches a
(so like BRE with respect to () {} )
How do I change the color it uses when I click find and it matches something? its a bit faint.
() and {} in textpad v5 anyway, seem to be literals when stand alone and operators when they are escaped.ben_josephs wrote:use of the symbols (, ), |, { and } as operators when they stand alone and as literals when the are escaped with backslashes, "
(a) matches (a)
\(a\) matches a
(so like BRE with respect to () {} )
How do I change the color it uses when I click find and it matches something? its a bit faint.
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm