Does anyone have an example of how to use regexsplit
Tom Poage
tfpoage at ucdavis.edu
Sat Sep 29 01:27:03 EDT 2012
I think the class RegexSplitAttributeDefinition is somewhat misnamed, then. Maybe RegexMatchAttributeDefinition would be more mnemonic of its purpose, given that many languages have a split() function of one form or another, and including "Split" in its name hints that it does something it doesn't appear to do.
Of course, that's no excuse for not reading the class docs, either. :-)
Tom.
On Sep 28, 2012, at 12:36 PM, Brent Putman <putmanb at georgetown.edu> wrote:
>
>
> On 9/27/12 6:42 PM, Tom Poage wrote:
>> Is the regex like (or does it invoke) Java's split() method? If so, the regex would be composed to match the separator, i.e. "/".
>
> No, it doesn't use split, it uses java.util.regex.Matcher and java.util.regex.Pattern essentially like this:
>
> Pattern pattern = Pattern.compile(regex);
> Matcher matcher = pattern.matcher(target);
> if(matcher.matches()) {
> return matcher.group(1);
> }
More information about the users
mailing list