<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <br>
    On 9/27/12 6:42 PM, Tom Poage wrote:<br>
    <blockquote
cite="mid:AEB7E9EFA600D74182F37D6300EA287201026405@exmbx13.ex.ad3.ucdavis.edu"
      type="cite">
      <pre wrap="">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. "/".

Tom.

</pre>
    </blockquote>
    <br>
    <br>
    <br>
    No, it doesn't use split, it uses java.util.regex.Matcher and
    java.util.regex.Pattern essentially like this:<br>
    <br>
    Pattern pattern = Pattern.compile(regex);<br>
    Matcher matcher = pattern.matcher(target);<br>
    if(matcher.matches()) {<br>
    &nbsp;return matcher.group(1);<br>
    }<br>
    <div class="moz-cite-prefix"><br>
      <br>
      Based on some quick testing, the following regex patterns do work
      on the OP's data:<br>
      <br>
      ^(Student|faculty|Faculty|Staff).*<br>
      ^(\\w+).*<br>
      <br>
      Without the wildcard pattern on the end (.*) it doesn't match
      (matcher.matches() returns false).&nbsp; <br>
      <br>
      This is different than Perl 5's behavior, which does match:<br>
      <br>
      perl -le '($result) = "Faculty/pt" =~
      /(Student|faculty|Faculty|Staff)/; print $result;'<br>
      <br>
      produces "Faculty".<br>
      <br>
      Javadoc for Pattern notes that "
      <meta http-equiv="content-type" content="text/html;
        charset=ISO-8859-1">
      The Pattern engine performs traditional NFA-based matching with
      ordered alternation as occurs in Perl 5."<br>
      <br>
      I don't immediately see any reason in the docs for the different
      behavior between the 2. But that's what it's doing apparently.<br>
      <br>
      --Brent<br>
      &nbsp; <br>
    </div>
  </body>
</html>