当前位置: 首页>>代码示例>>Java>>正文


Java Regex类代码示例

本文整理汇总了Java中org.joni.Regex的典型用法代码示例。如果您正苦于以下问题:Java Regex类的具体用法?Java Regex怎么用?Java Regex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Regex类属于org.joni包,在下文中一共展示了Regex类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Grok

import org.joni.Regex; //导入依赖的package包/类
@SuppressWarnings("unchecked")
Grok(Map<String, String> patternBank, String grokPattern, boolean namedCaptures) {
    this.patternBank = patternBank;
    this.namedCaptures = namedCaptures;

    this.expression = toRegex(grokPattern);
    byte[] expressionBytes = expression.getBytes(StandardCharsets.UTF_8);
    this.compiledExpression = new Regex(expressionBytes, 0, expressionBytes.length, Option.DEFAULT, UTF8Encoding.INSTANCE);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:Grok.java

示例2: OnigRegExp

import org.joni.Regex; //导入依赖的package包/类
public OnigRegExp(String source) {
	lastSearchStrUniqueId = null;
	lastSearchPosition = -1;
	lastSearchResult = null;
	byte[] pattern = source.getBytes(StandardCharsets.UTF_8);
	this.regex = new Regex(pattern, 0, pattern.length, Option.CAPTURE_GROUP, UTF8Encoding.INSTANCE, Syntax.DEFAULT,
			WarnCallback.DEFAULT);
}
 
开发者ID:eclipse,项目名称:tm4e,代码行数:9,代码来源:OnigRegExp.java

示例3: RegexpOpExp

import org.joni.Regex; //导入依赖的package包/类
public RegexpOpExp(ParserLiteral left, ParserLiteral right, int operator)
{
    super(left, right, operator);

    byte[] pattern = (((StringLiteral)right).val).getBytes(StandardCharsets.UTF_8);
    this.regex = new Regex(pattern, 0, pattern.length, Option.NONE, UTF8Encoding.INSTANCE);

    if (! left.isString()) {
        throw new ConfigException(String.format("\"%s\" is not a String column", ((IdentifierLiteral)left).name));
    }
}
 
开发者ID:sonots,项目名称:embulk-filter-row,代码行数:12,代码来源:ParserExp.java

示例4: getSingleModuleForPath

import org.joni.Regex; //导入依赖的package包/类
private List<Module> getSingleModuleForPath(File child) {
    if(child.getName().endsWith(".rb")) {
        try {
            @SuppressWarnings("unchecked")
            List<String> lines = FileUtils.readLines(child);
            if(lines.size() > 1) {
                String regex = lines.get(0);
                regex = regex.substring(1, regex.length()).trim();

                String triggers = lines.get(1);
                triggers = triggers.substring(1, triggers.length()).trim();

                String filename = child.getName();
                String name = filename.substring(0, filename.length() - 3);
                MewtwoMain.mewtwoLogger.info("Adding module " + name + " - regex = " + regex +
                        ", triggers = "+ triggers);

                Module m = new Module(
                        new Regex(regex.getBytes(), 0, regex.length(), Option.NONE, UTF8Encoding.INSTANCE),
                        Arrays.asList(triggers.split(",")), filename.substring(0, filename.length() - 3),
                        filename);

                return Arrays.asList(m);
            } else MewtwoMain.mewtwoLogger.info("Skipping file " + child.getAbsolutePath() + " - shorter than two lines!");
        } catch (Throwable t) {
            MewtwoMain.mewtwoLogger.error("Exception while parsing modules for " + child.getAbsolutePath() + "! ", t);
        }

    } else MewtwoMain.mewtwoLogger.info("Skipping file " + child.getAbsolutePath() + " - not a ruby file!");

    return Arrays.asList();
}
 
开发者ID:meew0,项目名称:Mewtwo,代码行数:33,代码来源:ModuleManager.java

示例5: generate

import org.joni.Regex; //导入依赖的package包/类
@Override
protected Regex generate(String i) {
    byte[] pattern = getBytesUTF16LE(i);
    return new Regex(pattern, 0, pattern.length, Option.NONE, UTF16LEEncoding.INSTANCE);
}
 
开发者ID:fbacchella,项目名称:RegexPerf,代码行数:6,代码来源:State_org_joni_utf16le.java

示例6: match

import org.joni.Regex; //导入依赖的package包/类
@Override
protected boolean match(Regex pattern, String searched) {
    byte[] str = getBytesUTF16LE(searched);
    Matcher matcher = pattern.matcher(str);
    return matcher.search(0, str.length, Option.DEFAULT) != -1;
}
 
开发者ID:fbacchella,项目名称:RegexPerf,代码行数:7,代码来源:State_org_joni_utf16le.java

示例7: generate

import org.joni.Regex; //导入依赖的package包/类
@Override
protected Regex generate(String i) {
    byte[] pattern = getBytesAscii(i);
    return new Regex(pattern, 0, pattern.length, Option.NONE, ASCIIEncoding.INSTANCE);
}
 
开发者ID:fbacchella,项目名称:RegexPerf,代码行数:6,代码来源:State_org_joni_ascii_reuse.java

示例8: match

import org.joni.Regex; //导入依赖的package包/类
@Override
protected boolean match(Regex pattern, String searched) {
    byte[] str = getBytesAscii(searched);
    Matcher matcher = pattern.matcher(str);
    return matcher.search(0, str.length, Option.DEFAULT) != -1;
}
 
开发者ID:fbacchella,项目名称:RegexPerf,代码行数:7,代码来源:State_org_joni_ascii_reuse.java

示例9: generate

import org.joni.Regex; //导入依赖的package包/类
@Override
protected Regex generate(String i) {
    byte[] pattern = i.getBytes();
    return new Regex(pattern, 0, pattern.length, Option.NONE, UTF8Encoding.INSTANCE);
}
 
开发者ID:fbacchella,项目名称:RegexPerf,代码行数:6,代码来源:State_org_joni.java

示例10: match

import org.joni.Regex; //导入依赖的package包/类
@Override
protected boolean match(Regex pattern, String searched) {
    byte[] str = searched.getBytes();
    Matcher matcher = pattern.matcher(str);
    return matcher.search(0, str.length, Option.DEFAULT) != -1;
}
 
开发者ID:fbacchella,项目名称:RegexPerf,代码行数:7,代码来源:State_org_joni.java

示例11: JoniRegexEngine

import org.joni.Regex; //导入依赖的package包/类
public JoniRegexEngine(String regex, int flags) {
  this.regex = regex;
  byte[] b = Bytes.toBytes(regex);
  this.pattern = new Regex(b, 0, b.length, patternToJoniFlags(flags), encoding, Syntax.Java);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:6,代码来源:RegexStringComparator.java

示例12: Module

import org.joni.Regex; //导入依赖的package包/类
public Module(Regex regex, List<String> trigger, String name, String filename) {
    this.regex = regex;
    this.triggers = trigger;
    this.name = name;
    this.filename = filename;
}
 
开发者ID:meew0,项目名称:Mewtwo,代码行数:7,代码来源:Module.java


注:本文中的org.joni.Regex类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。