public Pattern apply(String pattern) { try { PatternCompiler pc = new Perl5Compiler(); return pc.compile(pattern, Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.SINGLELINE_MASK); } catch (MalformedPatternException e) { throw new RuntimeException(e); } } });
public Pattern apply(String pattern) { try { PatternCompiler pc = new Perl5Compiler(); return pc.compile(pattern, Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.READ_ONLY_MASK); } catch (MalformedPatternException e) { throw new RuntimeException("Regex failed!", e); } } });
/** * Initialize the compiledPattern protected member. * * @param compiler * @throws Exception */ protected void initCompiledPattern(PatternCompiler compiler) throws Exception { compiledPattern = compiler.compile(convertedPattern, Perl5Compiler.READ_ONLY_MASK); }
/** * 创建新的pattern. * * @param compiler pattern编译器 * @param pattern 用于匹配正则表达式的pattern * @throws MalformedPatternException 如果pattern不合法 */ public MatchPattern(PatternCompiler compiler, String pattern) throws MalformedPatternException { this.pattern = compiler.compile(pattern); }
/** * 创建新的pattern. * * @param compiler pattern编译器 * @param pattern 用于匹配正则表达式的pattern * @param options 编译器选项 * @throws MalformedPatternException 如果pattern不合法 */ public MatchPattern(PatternCompiler compiler, String pattern, int options) throws MalformedPatternException { this.pattern = compiler.compile(pattern, options); }
@Override public Pattern load(String key) throws Exception { try { PatternCompiler pc = new Perl5Compiler(); return pc.compile(key, Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.READ_ONLY_MASK); } catch (MalformedPatternException e) { throw new RuntimeException("Regex failed!", e); } }
public Pattern apply(String pattern) { try { PatternCompiler pc = new Perl5Compiler(); return pc.compile(pattern, Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.READ_ONLY_MASK); } catch (MalformedPatternException e) { throw new RuntimeException("Regex failed!", e); } } });
public void setUrlPattern(String urlPattern) { this.urlPattern = urlPattern; this.pattern = null; try { PatternCompiler compiler = new GlobCompiler(); this.pattern = compiler.compile(this.urlPattern); } catch (Exception e) { log.error("Invalid url pattern: " + this.urlPattern); } }
public Oracle8Builder(Platform platform) { super(platform); addEscapedCharSequence("'", "''"); PatternCompiler compiler = new Perl5Compiler(); try { _isoDatePattern = compiler.compile("\\d{4}\\-\\d{2}\\-\\d{2}"); _isoTimePattern = compiler.compile("\\d{2}:\\d{2}:\\d{2}"); _isoTimestampPattern = compiler.compile("\\d{4}\\-\\d{2}\\-\\d{2} \\d{2}:\\d{2}:\\d{2}[\\.\\d{1,8}]?"); } catch (MalformedPatternException ex) { throw new DdlUtilsException(ex); } }
@Override public Pattern load(String key) throws Exception { PatternCompiler pc = new Perl5Compiler(); try { return pc.compile(key, Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.READ_ONLY_MASK); } catch (MalformedPatternException e) { throw new DatalinkException("invalid config", e); } } });
public Pattern apply(String input) { PatternCompiler pc = new Perl5Compiler(); try { return pc.compile(input, Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.READ_ONLY_MASK); } catch (MalformedPatternException e) { throw new ConfigException(e); } } });
public Pattern apply(String pattern) { try { PatternCompiler pc = new Perl5Compiler(); return pc.compile(pattern, Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.SINGLELINE_MASK); } catch (MalformedPatternException e) { throw new CanalFilterException(e); } } });
public OracleModelReader(Platform platform) { super(platform); setDefaultCatalogPattern(null); setDefaultSchemaPattern(null); setDefaultTablePattern("%"); PatternCompiler compiler = new Perl5Compiler(); try { _oracleIsoDatePattern = compiler.compile("TO_DATE\\('([^']*)'\\, 'YYYY\\-MM\\-DD'\\)"); _oracleIsoTimePattern = compiler.compile("TO_DATE\\('([^']*)'\\, 'HH24:MI:SS'\\)"); _oracleIsoTimestampPattern = compiler.compile("TO_DATE\\('([^']*)'\\, 'YYYY\\-MM\\-DD HH24:MI:SS'\\)"); } catch (MalformedPatternException ex) { throw new DdlUtilsException(ex); } }
public Db2ModelReader(Platform platform) { super(platform); setDefaultCatalogPattern(null); setDefaultSchemaPattern(null); PatternCompiler compiler = new Perl5Compiler(); try { _db2TimePattern = compiler.compile("'(\\d{2}).(\\d{2}).(\\d{2})'"); _db2TimestampPattern = compiler.compile("'(\\d{4}\\-\\d{2}\\-\\d{2})\\-(\\d{2}).(\\d{2}).(\\d{2})(\\.\\d{1,8})?'"); } catch (MalformedPatternException ex) { throw new DdlUtilsException(ex); } }
public NameSelector(final String name, final boolean ignoreCase) throws MalformedPatternException { assert name != null; PatternCompiler compiler = new GlobCompiler(); int options; if (ignoreCase) { options = GlobCompiler.CASE_INSENSITIVE_MASK; } else { options = GlobCompiler.DEFAULT_MASK; } this.pattern = compiler.compile(name, options); this.matcher = new Perl5Matcher(); log.trace("Pattern: {}", pattern.getPattern()); }
public NameSelector(final String name, final boolean ignoreCase) throws MalformedPatternException { assert name != null; PatternCompiler compiler = new GlobCompiler(); int options; if (ignoreCase) { options = GlobCompiler.CASE_INSENSITIVE_MASK; } else { options = GlobCompiler.DEFAULT_MASK; } this.pattern = compiler.compile(name, options); this.matcher = new Perl5Matcher(); log.trace("Pattern: {}", pattern.getPattern()); }
public MSSqlModelReader(Platform platform) { super(platform); setDefaultCatalogPattern(null); setDefaultSchemaPattern(null); setDefaultTablePattern("%"); PatternCompiler compiler = new Perl5Compiler(); try { _isoDatePattern = compiler.compile("'(\\d{4}\\-\\d{2}\\-\\d{2})'"); _isoTimePattern = compiler.compile("'(\\d{2}:\\d{2}:\\d{2})'"); } catch (MalformedPatternException ex) { throw new DdlUtilsException(ex); } }
public SybaseModelReader(Platform platform) { super(platform); setDefaultCatalogPattern(null); setDefaultSchemaPattern(null); setDefaultTablePattern("%"); PatternCompiler compiler = new Perl5Compiler(); try { _isoDatePattern = compiler.compile("'(\\d{4}\\-\\d{2}\\-\\d{2})'"); _isoTimePattern = compiler.compile("'(\\d{2}:\\d{2}:\\d{2})'"); } catch (MalformedPatternException ex) { throw new DdlUtilsException(ex); } }
/** * The right syntax for rules is regexp$ substitution * like Apache redirecter rules */ public void initialize(Object values[]) { super.initialize(values); PatternCompiler compiler = new Perl5Compiler(); try { dec_pat = compiler.compile("(.*)\\$\\s+(.*)"); } catch (MalformedPatternException ex) { ex.printStackTrace(); // should never happen } }
private static boolean doMatch( String content, String pattern ) throws PluginException { PatternCompiler compiler = new Perl5Compiler(); PatternMatcher matcher = new Perl5Matcher(); try { Pattern matchp = compiler.compile( pattern, Perl5Compiler.SINGLELINE_MASK ); // m_exceptPattern = compiler.compile( exceptPattern, Perl5Compiler.SINGLELINE_MASK ); return matcher.matches( content, matchp ); } catch( MalformedPatternException e ) { throw new PluginException("Faulty pattern "+pattern); } }