Sorry I reveal my novice understanding of perlre. What I am looking for is a way to do an exact match, not a contains. For example, let's pretend there is such a method called matchesExact() which would behave as follows for my pattern:
Pattern pattern = compiler.compile("|STUFF|JUNK"); matcher.matchesExact("", pattern); // return true matcher.matchesExact(" ", pattern); // return false matcher.matchesExact("STUFF", pattern); // return true matcher.matchesExact("STUFFY", pattern); // return false matcher.matchesExact("JUNK", pattern); // return true matcher.matchesExact("JUNKY", pattern); // return false That is, my input can only be one of "", "STUFF", or "JUNK". Nothing else is valid even if it contains "STUFF" or "JUNK" in its string. Is there a way ORO to do this? Or is there a way to specify this in the pattern itself? -Jerome -----Original Message----- From: Daniel F. Savarese [mailto:dfs@;savarese.org] Sent: Thursday, November 14, 2002 3:30 PM To: ORO Users List Subject: Re: Perl5 and Alternate strange behavior In message <[EMAIL PROTECTED]>, "Jero me Jacobsen" writes: >I have a Pattern like this: >Pattern pattern = compiler.compile("|STUFF"); > >I would expect both of the following to return true: >matcher.matches("", pattern); // returns true >matcher.matches("STUFF", pattern); // returns false! matches() is not the same as contains() and matches(input, "pattern") is not the same as matches(input, "^pattern$"). Look at the "Note:" in the javadocs for Perl5Matcher.matches() for an explanation. daniel -- To unsubscribe, e-mail: <mailto:oro-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:oro-user-help@;jakarta.apache.org> -- To unsubscribe, e-mail: <mailto:oro-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:oro-user-help@;jakarta.apache.org>