Oh my God!!! That is the explanation '-' is part of the metalanguage.
Thanks
On Tuesday, July 17, 2012 09:16:46 AM David Winslow wrote:
> Ah right, I didn't think about it but "-" is a special character inside of
> character classes in Java regular expressions. So "|-|" is parsed as a
> range from | to | (inclusive.) I guess when the - is the first character
> in the class the parser assumes it should be treated as an escape, but if
> you want to be explicit you can also escape it with a \. Backslashes also
> must be escaped in Java string literals so the end result would be
> .split("[+\\-Z]")
>
> --
> David Winslow
> OpenGeo - http://opengeo.org/
>
> On Tue, Jul 17, 2012 at 3:28 AM, Mauricio Pazos
<[email protected]>wrote:
> > On Monday, July 16, 2012 09:47:59 AM David Winslow wrote:
> > > Actually, the square brackets denote a character class, so logical OR is
> > > the default behavior and | has no special meaning.
> >
> > String.split("[-|+|Z]")
> >
> > > will split on any of the characters '-' '+' '|' and 'Z' (note that the
> >
> > pipe
> >
> > > character is included in this list! that's probably not intended.) See
> > > http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html#cc
> >
> > Thanks for clarification. The, bug here is related with the sequence in
> > the
> > character list. It looks like is not equal
> > str = "aaaa-bbbb"
> > str.split("[-|+|Z]") Not equal to str.split("[+|-|Z]")
> >
> > but
> >
> > str = "aaaa-bbbb"
> > str.split("[-+Z]") equal to str.split("[+-Z]")
> >
> > cheers
> > --
> > Mauricio Pazos
--
Mauricio Pazos
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel