Toby,
If I understand your JUnit tests, you want to have the first character NOT
in the set 'a-zA-Z0-9?&'. You have made this first character optionally NOT
in the set 'a-zA-Z0-9?&'. Try using "^[^a-zA-Z0-9?&]" (no ?) as the RE. It
then works for me!
Roger
> -----Original Message-----
> From: [EMAIL PROTECTED]
> Sent: 31 October 2001 09:01
> To: [EMAIL PROTECTED]
> Subject: Wrong Regexp or Bug in implementation of negated character
> classe s?
>
> Hi Folks,
>
> I'm using the following code in a JUnit Test Suite. The Regexp
> "^[^a-zA-Z0-9?&]?" is used to matche a couple of strings.
> In assertEquals(....) I check, if the result of seperatorRegEx is false.
> As
> far as I know either a "b", a "&" or a "?"
> should match my regex.
>
> Code:
>
> RE seperatorRegEx = new RE( new
> RECompiler().compile("^[^a-zA-Z0-9?&]?"));
> assertTrue("seperatorRegEx fails", seperatorRegEx.match(","));
> assertTrue("seperatorRegEx fails", seperatorRegEx.match("."));
> assertTrue("seperatorRegEx fails", seperatorRegEx.match(";"));
> assertTrue("seperatorRegEx fails", seperatorRegEx.match("-"));
> assertTrue("seperatorRegEx fails", seperatorRegEx.match("*"));
> assertTrue("seperatorRegEx fails", seperatorRegEx.match("'"));
> assertTrue("seperatorRegEx fails", seperatorRegEx.match("#"));
> assertTrue("seperatorRegEx fails", seperatorRegEx.match("~"));
> assertEquals("seperatorRegEx fails on garbage", false,
> seperatorRegEx.match("b")); <-- throws AssertionException (from JUnit)
> assertEquals("seperatorRegEx fails on garbage", false,
> seperatorRegEx.match("&")); <-- throws AssertionException (from JUnit)
> assertEquals("seperatorRegEx fails on garbage", false,
> seperatorRegEx.match("?")); <-- throws AssertionException (from JUnit)
>
> I checked my regexp against a simple perl programm and the online-applet
> form Apache-ORO package.
> So what's wrong with my regexp?
>
> Any ideas?
>
> Thx
>
> Toby
>
>
>
> Mit freundlichen Gr��en
> Best regards
>
> Tobias Rademacher
>
> --------------------------------------------------------------------------
> --
> ------
> Tobias Rademacher
> Software Development
> CEYONIQ Healthcare Fon: +49 (0)821 44490-0
> GmbH & Co. KG Fax: +49 (0)821 44490-60
> Kurzes Gel�nd 6 mailto:[EMAIL PROTECTED]
> 86156 Augsburg www.ceyoniq.com
> Germany
> --------------------------------------------------------------------------
> --
> -----------
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
Legal Disclaimer:-
Internet communications are not secure and therefore the
Barclays Group does not accept legal responsibility for the
contents of this message. Although the Barclays Group
operates anti-virus programmes, it does not accept
responsibility for any damage whatsoever that is caused
by viruses being passed. Any views or opinions presented
are solely those of the author and do not necessarily
represent those of the Barclays Group.
Replies to this e-mail may be monitored by the Barclays
Group for operational or business reasons.
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>