A couple of things to remember when using this class are that the {@link #match match()} methods have the same meaning as{@link org.apache.oro.text.regex.Perl5Matcher#contains Perl5Matcher.contains()}and =~ m/pattern/
in Perl. The methods are named match to more closely associate them with Perl and to differentiate them from {@link org.apache.oro.text.regex.Perl5Matcher#matches Perl5Matcher.matches()}. A further thing to keep in mind is that the {@link MalformedPerl5PatternException} class is derived fromRuntimeException which means you DON'T have to catch it. The reasoning behind this is that you will detect your regular expression mistakes as you write and debug your program when a MalformedPerl5PatternException is thrown during a test run. However, we STRONGLY recommend that you ALWAYS catch MalformedPerl5PatternException whenever you deal with a DYNAMICALLY created pattern. Relying on a fatal MalformedPerl5PatternException being thrown to detect errors while debugging is only useful for dealing with static patterns, that is, actual pregenerated strings present in your program. Patterns created from user input or some other dynamic method CANNOT be relied upon to be correct and MUST be handled by catching MalformedPerl5PatternException for your programs to be robust.
Finally, as a convenience Perl5Util implements the {@link org.apache.oro.text.regex.MatchResult MatchResult} interface.The methods are merely wrappers which call the corresponding method of the last {@link org.apache.oro.text.regex.MatchResult MatchResult}found (which can be accessed with {@link #getMatch()} by a match orsubstitution (or even a split, but this isn't particularly useful). @author Daniel F. Savarese @version @version@ @since 1.0 @see MalformedPerl5PatternException @see org.apache.oro.text.PatternCache @see org.apache.oro.text.PatternCacheLRU @see org.apache.oro.text.regex.MatchResult
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|