本文整理了Java中org.apache.oro.text.regex.Util
类的一些代码示例,展示了Util
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util
类的具体详情如下:
包路径:org.apache.oro.text.regex.Util
类名称:Util
暂无
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
public String substitute(String line)
{
return org.apache.oro.text.regex.Util.substitute(getMatcher(), getPattern(), this, line,
org.apache.oro.text.regex.Util.SUBSTITUTE_ALL);
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_functions
Util.split(pieces, matcher, templatePattern, rawTemplate);
PatternMatcherInput input = new PatternMatcherInput(rawTemplate);
boolean startsWith = isFirstElementGroup(rawTemplate);
代码示例来源:origin: org.apache.ant/ant-apache-oro
new Perl5Substitution(subst.toString(),
Perl5Substitution.INTERPOLATE_ALL);
return Util.substitute(matcher,
getCompiledPattern(options),
s,
代码示例来源:origin: com.atlassian.jira/jira-api
/** Equivalent of JDK 1.4's {@link String#replaceAll(String regex, String replacement)}, usable in JDK 1.3
*
* @param str The string to apply operations to
* @param regex The regex that str should match
* @param replacement String to replace matched string with (using $1, $2 etc for substitutions).
* @return A modified version of str, or null if the regexp was invalid
*/
public static String replaceAll(final String str, String regex, String replacement)
{
Pattern pattern;
try
{
pattern = new Perl5Compiler().compile(regex);
}
catch (MalformedPatternException e)
{
log.error("Error parsing regexp '"+regex+"' - "+e, e);
return null;
}
return Util.substitute(new Perl5Matcher(), pattern, new Perl5Substitution(replacement), str, Util.SUBSTITUTE_ALL);
// return str.replaceAll(regex, replacement);
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_components
private String filterString(final String content) {
if (stringsToSkip == null || stringsToSkip.isEmpty()) {
return content;
} else {
String result = content;
for (SubstitutionElement regex : stringsToSkip) {
emptySub.setSubstitution(regex.getSubstitute());
result = Util.substitute(JMeterUtils.getMatcher(), JMeterUtils.getPatternCache().getPattern(regex.getRegex()),
emptySub, result, Util.SUBSTITUTE_ALL);
}
return result;
}
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core
@Override
public JMeterProperty transformValue(JMeterProperty prop) throws InvalidVariableException {
PatternMatcher pm = JMeterUtils.getMatcher();
PatternCompiler compiler = new Perl5Compiler();
String input = prop.getStringValue();
if(input == null) {
return prop;
}
for(Entry<String, String> entry : getVariables().entrySet()){
String key = entry.getKey();
String value = entry.getValue();
if (regexMatch) {
try {
Pattern pattern = compiler.compile(constructPattern(value));
input = Util.substitute(pm, pattern,
new StringSubstitution(FUNCTION_REF_PREFIX + key + FUNCTION_REF_SUFFIX),
input, Util.SUBSTITUTE_ALL);
} catch (MalformedPatternException e) {
log.warn("Malformed pattern: {}", value);
}
} else {
input = StringUtilities.substitute(input, value, FUNCTION_REF_PREFIX + key + FUNCTION_REF_SUFFIX);
}
}
return new StringProperty(prop.getName(), input);
}
代码示例来源:origin: com.bbossgroups/bboss-util
if(sets.size() > 0)
newsrc = Util.substitute(matcher, pattern, new Perl5Substitution(substitution),
src, Util.SUBSTITUTE_ALL);
代码示例来源:origin: org.w3c.jigsaw/jigsaw
if (matcher.matches(requrl, pat[i])) {
Substitution s = new Perl5Substitution(sub[i]);
result = Util.substitute(matcher, pat[i], s, requrl,
Util.SUBSTITUTE_ALL);
break;
代码示例来源:origin: com.bbossgroups/bboss-util
if(sets.size() > 0)
newsrc = Util.substitute(matcher, pattern, new Perl5Substitution(substitution),
src, Util.SUBSTITUTE_ALL);
代码示例来源:origin: com.bbossgroups/bboss-util
public static String replaceAll(String val, String str1, String str2,
int mask) {
String patternStr = str1;
/**
* 编译正则表达式patternStr,并用该表达式与传入的sql语句进行模式匹配,
* 如果匹配正确,则从匹配对象中提取出以上定义好的6部分,存放到数组中并返回 该数组
*/
PatternCompiler compiler = new Perl5Compiler();
Pattern pattern = null;
try {
pattern = compiler.compile(patternStr,
mask);
PatternMatcher matcher = new Perl5Matcher();
return org.apache.oro.text.regex.Util.substitute(matcher, pattern,
new StringSubstitution(str2), val,
org.apache.oro.text.regex.Util.SUBSTITUTE_ALL);
} catch (MalformedPatternException e) {
e.printStackTrace();
return val;
}
}
代码示例来源:origin: com.bbossgroups/bboss-util
public static String replaceFirst(String val, String str1, String str2,
boolean CASE_INSENSITIVE) {
String patternStr = str1;
/**
* 编译正则表达式patternStr,并用该表达式与传入的sql语句进行模式匹配,
* 如果匹配正确,则从匹配对象中提取出以上定义好的6部分,存放到数组中并返回 该数组
*/
PatternCompiler compiler = new Perl5Compiler();
Pattern pattern = null;
try {
if (CASE_INSENSITIVE) {
pattern = compiler.compile(patternStr,
Perl5Compiler.DEFAULT_MASK);
} else {
pattern = compiler.compile(patternStr,
Perl5Compiler.CASE_INSENSITIVE_MASK);
}
PatternMatcher matcher = new Perl5Matcher();
return org.apache.oro.text.regex.Util.substitute(matcher, pattern,
new StringSubstitution(str2), val);
} catch (MalformedPatternException e) {
e.printStackTrace();
return val;
}
}
代码示例来源:origin: com.bbossgroups/bboss-util
public static String replaceAll(String val, String str1, String str2,
boolean CASE_INSENSITIVE) {
String patternStr = str1;
/**
* 编译正则表达式patternStr,并用该表达式与传入的sql语句进行模式匹配,
* 如果匹配正确,则从匹配对象中提取出以上定义好的6部分,存放到数组中并返回 该数组
*/
PatternCompiler compiler = new Perl5Compiler();
Pattern pattern = null;
try {
if (CASE_INSENSITIVE) {
pattern = compiler.compile(patternStr,
Perl5Compiler.DEFAULT_MASK);
} else {
pattern = compiler.compile(patternStr,
Perl5Compiler.CASE_INSENSITIVE_MASK);
}
PatternMatcher matcher = new Perl5Matcher();
return org.apache.oro.text.regex.Util.substitute(matcher, pattern,
new StringSubstitution(str2), val,
org.apache.oro.text.regex.Util.SUBSTITUTE_ALL);
} catch (MalformedPatternException e) {
e.printStackTrace();
return val;
}
}
内容来源于网络,如有侵权,请联系作者删除!