// Uncolored, plain source file:  chararray.java
//    chararray.java by Steven R. Brandt
//    <p>
//    An example file explaining how to use
//    com.stevesoft.pat, com.stevesoft.pat.wrap,
//    and com.stevesoft.pat.apps
//    <p>
//    This software comes without express or implied warranty.
//    No claim is made about the suitability of this software for
//    any purpose and neither I nor SteveSoft shall be liable for
//    damages suffered by the user of this software.
import com.stevesoft.pat.wrap.*;
import com.stevesoft.pat.*;

// An example of how to search a char[] using Regex.
public class chararray {
  public static void main(String[] args) {
    char[] str =
      "Where is the word 'foo' in this sentence?".toCharArray();
    Regex findFoo = new Regex("foo");
    findFoo.search(new CharArrayWrap(str));
    System.out.println(
      "Foo found at index: "+findFoo.matchedFrom());
  }
}