Searches for the first pattern match somewhere in a character array taking a pattern specified in Perl5 native format:
[m]/pattern/[i][m][s][x]
The
m
prefix is optional and the meaning of the optional trailing options are:
- i
- case insensitive match
- m
- treat the input as consisting of multiple lines
- s
- treat the input as consisting of a single line
- x
- enable extended expression syntax incorporating whitespace and comments
As with Perl, any non-alphanumeric character can be used in lieu of the slashes.
If the input contains the pattern, the org.apache.oro.text.regex.MatchResult can be obtained by calling {@link #getMatch()}. However, Perl5Util implements the MatchResult interface as a wrapper around the last MatchResult found, so you can call its methods to access match information.
@param pattern The pattern to search for.
@param input The char[] input to search.
@return True if the input contains the pattern, false otherwise.
@exception MalformedPerl5PatternException If there is an error inthe pattern. You are not forced to catch this exception because it is derived from RuntimeException.