1 package org.jacorb.notification.util; 2 3 23 24 import gnu.regexp.REException; 25 import gnu.regexp.REMatch; 26 27 31 32 public class GNUPatternWrapper extends PatternWrapper 33 { 34 private gnu.regexp.RE pattern_; 35 36 public void compile(String patternString) 37 { 38 try 39 { 40 pattern_ = new gnu.regexp.RE(patternString); 41 } catch (REException e) 42 { 43 throw new RuntimeException (e.getMessage()); 44 } 45 } 46 47 public int match(String text) 48 { 49 REMatch[] _match = pattern_.getAllMatches(text); 50 51 if (_match.length > 0) 52 { 53 int _last = _match.length - 1; 54 return _match[_last].getEndIndex(); 55 } 56 57 return 0; 58 } 59 60 public String toString() 61 { 62 return pattern_.toString(); 63 } 64 } | Popular Tags |