Menu

#19 Character Class - interpreting too many metachars?

open
nobody
None
5
2006-07-20
2006-07-20
steve
No

the following regex throws an exception:

\sCOPY\s[^{\n]*\{\d{4,}\}

jregex.PatternSyntaxException: unknown named class:
{\n]*\\d4,}

this seems to be an error as http://www.pcre.org/pcre.txt
states the valid metacharacters in a character class are
\ general escape character
^ negate the class, but only if the first
character
- indicates character range
[ POSIX character class (only if followed
by POSIX
syntax)
] terminates the character class

I'm aware that I can write as
\sCOPY\s[^\{\n]*\{\d{4,}\}

however other engines seem to work without the extra \.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.