Does anyone have an example of how to use regexsplit

Christopher Bongaarts cab at umn.edu
Fri Sep 28 15:47:06 EDT 2012


On 9/28/2012 2:36 PM, Brent Putman wrote:
> Without the wildcard pattern on the end (.*) it doesn't match
> (matcher.matches() returns false).
>
> This is different than Perl 5's behavior, which does match:
[...]
> Javadoc for Pattern notes that " The Pattern engine performs traditional
> NFA-based matching with ordered alternation as occurs in Perl 5."

I bumped into this on another project I was working on, since my perl 
fluency greatly exceeds my Java knowledge.  The key difference seems to 
be that Perl's "match" operator means "find this pattern somewhere in 
the source string", while the Java match() method means "does this 
pattern exactly match the entire source string".  The actual regex is 
the same, but how they are applied is subtly different (and easy to work 
around once you realize what's happening).

-- 
%%  Christopher A. Bongaarts   %%  cab at umn.edu          %%
%%  OIT - Identity Management  %%  http://umn.edu/~cab  %%
%%  University of Minnesota    %%  +1 (612) 625-1809    %%


More information about the users mailing list