當前位置: 首頁>>代碼示例>>Java>>正文


Java Perl5Matcher.matches方法代碼示例

本文整理匯總了Java中org.apache.oro.text.regex.Perl5Matcher.matches方法的典型用法代碼示例。如果您正苦於以下問題:Java Perl5Matcher.matches方法的具體用法?Java Perl5Matcher.matches怎麽用?Java Perl5Matcher.matches使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.oro.text.regex.Perl5Matcher的用法示例。


在下文中一共展示了Perl5Matcher.matches方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: listFiles

import org.apache.oro.text.regex.Perl5Matcher; //導入方法依賴的package包/類
private static List<File> listFiles(File dir, Pattern _pattern, boolean _recurse, int listType) {
	File[] files = (_pattern == null ? dir.listFiles() : listFiles(dir, _pattern, listType));
	List<File> filesList = new ArrayList<File>();
	Perl5Matcher matcher = ( _pattern == null ? null : new Perl5Matcher() );

	if (files != null) {
		for (int i = 0; i < files.length; i++) {
			boolean isDir = files[i].isDirectory();

			if (isDir && _recurse) {
				filesList.addAll(listFiles(files[i], _pattern, _recurse, listType));
			}

			if ((listType == LIST_TYPE_DIR && !isDir) || (listType == LIST_TYPE_FILE && isDir))
				continue;

			if ( _pattern == null || matcher.matches( files[i].getName(), _pattern ) ){
				filesList.add(files[i]);
			}
		}
	}
	return filesList;
}
 
開發者ID:OpenBD,項目名稱:openbd-core,代碼行數:24,代碼來源:FileUtils.java

示例2: checkPath

import org.apache.oro.text.regex.Perl5Matcher; //導入方法依賴的package包/類
public boolean checkPath(InodeHandle inode) {
	Perl5Matcher m = new Perl5Matcher();
	
	String path = inode.getPath();
	if (inode.isDirectory() && !inode.getPath().endsWith("/")) {
		path = inode.getPath().concat("/");
	}
	
	return m.matches(path, _pat);
}
 
開發者ID:drftpd-ng,項目名稱:drftpd3,代碼行數:11,代碼來源:GlobPathPermission.java

示例3: matchesHost

import org.apache.oro.text.regex.Perl5Matcher; //導入方法依賴的package包/類
public boolean matchesHost(InetAddress a) throws MalformedPatternException {
	Perl5Matcher m = new Perl5Matcher();
	GlobCompiler c = new GlobCompiler();
	Pattern p = c.compile(getHostMask());

	return (m.matches(a.getHostAddress(), p) || m.matches(a.getHostName(),
			p));
}
 
開發者ID:drftpd-ng,項目名稱:drftpd3,代碼行數:9,代碼來源:HostMask.java

示例4: matchesIdent

import org.apache.oro.text.regex.Perl5Matcher; //導入方法依賴的package包/類
public boolean matchesIdent(String ident) throws MalformedPatternException {
	Perl5Matcher m = new Perl5Matcher();
	GlobCompiler c = new GlobCompiler();

	if (ident == null) {
		ident = "";
	}

	return !isIdentMaskSignificant()
			|| m.matches(ident, c.compile(getIdentMask()));
}
 
開發者ID:drftpd-ng,項目名稱:drftpd3,代碼行數:12,代碼來源:HostMask.java

示例5: process

import org.apache.oro.text.regex.Perl5Matcher; //導入方法依賴的package包/類
public void process(ScoreChart scorechart, User user, InetAddress source,
		char direction, InodeHandleInterface file, RemoteSlave sourceSlave) {
	Perl5Matcher m = new Perl5Matcher();
	boolean validPath = _negateExpr ? !m.matches(file.getPath(), _p) : m.matches(file.getPath(), _p);
	if (validPath) {
		AssignSlave.addScoresToChart(_assigns, scorechart);
	}
}
 
開發者ID:drftpd-ng,項目名稱:drftpd3,代碼行數:9,代碼來源:MatchdirFilter.java

示例6: clearMatcherMemory

import org.apache.oro.text.regex.Perl5Matcher; //導入方法依賴的package包/類
/**
 * Hack to make matcher clean the two internal buffers it keeps in memory which size is equivalent to 
 * the unzipped page size
 * @param matcher {@link Perl5Matcher}
 * @param pattern Pattern
 */
public static void clearMatcherMemory(Perl5Matcher matcher, Pattern pattern) {
    try {
        if (pattern != null) {
            matcher.matches("", pattern); // $NON-NLS-1$
        }
    } catch (Exception e) {
        // NOOP
    }
}
 
開發者ID:johrstrom,項目名稱:cloud-meter,代碼行數:16,代碼來源:JMeterUtils.java

示例7: visit

import org.apache.oro.text.regex.Perl5Matcher; //導入方法依賴的package包/類
@Override
public Object visit(StringBinaryComparison n, Void arg) {
	String first = (String) n.getLeftOperand().accept(this, null);
	String second = (String) n.getRightOperand().accept(this, null);

	Operator op = n.getOperator();
	switch (op) {
	case EQUALSIGNORECASE:
		return first.equalsIgnoreCase(second) ? TRUE_VALUE : FALSE_VALUE;
	case EQUALS:
		return first.equals(second) ? TRUE_VALUE : FALSE_VALUE;
	case ENDSWITH:
		return first.endsWith(second) ? TRUE_VALUE : FALSE_VALUE;
	case CONTAINS:
		return first.contains(second) ? TRUE_VALUE : FALSE_VALUE;
	case PATTERNMATCHES:
		return second.matches(first) ? TRUE_VALUE : FALSE_VALUE;
	case APACHE_ORO_PATTERN_MATCHES: {
		Perl5Matcher matcher = new Perl5Matcher();
		Perl5Compiler compiler = new Perl5Compiler();
		Pattern pattern;
		try {
			pattern = compiler.compile(first);
		} catch (MalformedPatternException e) {
			throw new RuntimeException(e);
		}
		return matcher.matches(second, pattern) ? TRUE_VALUE : FALSE_VALUE;

	}
	default:
		log.warn("StringComparison: unimplemented operator!" + op);
		return null;
	}

}
 
開發者ID:EvoSuite,項目名稱:evosuite,代碼行數:36,代碼來源:ExpressionExecutor.java

示例8: parseDdl

import org.apache.oro.text.regex.Perl5Matcher; //導入方法依賴的package包/類
private static DdlResult parseDdl(String queryString, String schmeaName, String pattern, int index) {
    Perl5Matcher matcher = new Perl5Matcher();
    if (matcher.matches(queryString, PatternUtils.getPattern(pattern))) {
        DdlResult result = parseTableName(matcher.getMatch().group(index), schmeaName);
        return result != null ? result : new DdlResult(schmeaName); // 無法解析時,直接返回schmea,進行兼容處理
    }

    return null;
}
 
開發者ID:alibaba,項目名稱:canal,代碼行數:10,代碼來源:SimpleDdlParser.java

示例9: isDml

import org.apache.oro.text.regex.Perl5Matcher; //導入方法依賴的package包/類
private static boolean isDml(String queryString, String pattern) {
    Perl5Matcher matcher = new Perl5Matcher();
    if (matcher.matches(queryString, PatternUtils.getPattern(pattern))) {
        return true;
    } else {
        return false;
    }
}
 
開發者ID:alibaba,項目名稱:canal,代碼行數:9,代碼來源:SimpleDdlParser.java

示例10: parseRename

import org.apache.oro.text.regex.Perl5Matcher; //導入方法依賴的package包/類
private static DdlResult parseRename(String queryString, String schmeaName, String pattern) {
    Perl5Matcher matcher = new Perl5Matcher();
    if (matcher.matches(queryString, PatternUtils.getPattern(pattern))) {
        DdlResult orign = parseTableName(matcher.getMatch().group(1), schmeaName);
        DdlResult target = parseTableName(matcher.getMatch().group(2), schmeaName);
        if (orign != null && target != null) {
            return new DdlResult(target.getSchemaName(),
                target.getTableName(),
                orign.getSchemaName(),
                orign.getTableName());
        }
    }

    return null;
}
 
開發者ID:alibaba,項目名稱:canal,代碼行數:16,代碼來源:SimpleDdlParser.java

示例11: parseTableName

import org.apache.oro.text.regex.Perl5Matcher; //導入方法依賴的package包/類
private static DdlResult parseTableName(String matchString, String schmeaName) {
    Perl5Matcher tableMatcher = new Perl5Matcher();
    matchString = matchString + " ";
    if (tableMatcher.matches(matchString, PatternUtils.getPattern(TABLE_PATTERN))) {
        String tableString = tableMatcher.getMatch().group(3);
        if (StringUtils.isEmpty(tableString)) {
            return null;
        }

        tableString = StringUtils.removeEnd(tableString, ";");
        tableString = StringUtils.removeEnd(tableString, "(");
        tableString = StringUtils.trim(tableString);
        // 特殊處理引號`
        tableString = removeEscape(tableString);
        // 處理schema.table的寫法
        String names[] = StringUtils.split(tableString, ".");
        if (names.length == 0) {
            return null;
        }

        if (names != null && names.length > 1) {
            return new DdlResult(removeEscape(names[0]), removeEscape(names[1]));
        } else {
            return new DdlResult(schmeaName, removeEscape(names[0]));
        }
    }

    return null;
}
 
開發者ID:alibaba,項目名稱:canal,代碼行數:30,代碼來源:SimpleDdlParser.java

示例12: call

import org.apache.oro.text.regex.Perl5Matcher; //導入方法依賴的package包/類
public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2) {
    String pattern = FunctionUtils.getStringValue(arg1, env);
    String text = FunctionUtils.getStringValue(arg2, env);
    Perl5Matcher matcher = new Perl5Matcher();
    boolean isMatch = matcher.matches(text, PatternUtils.getPattern(pattern));
    return AviatorBoolean.valueOf(isMatch);
}
 
開發者ID:alibaba,項目名稱:canal,代碼行數:8,代碼來源:RegexFunction.java

示例13: clearMatcherMemory

import org.apache.oro.text.regex.Perl5Matcher; //導入方法依賴的package包/類
/**
 * Hack to make matcher clean the two internal buffers it keeps in memory which size is equivalent to 
 * the unzipped page size
 * @param matcher {@link Perl5Matcher}
 * @param pattern Pattern
 */
public static final void clearMatcherMemory(Perl5Matcher matcher, Pattern pattern) {
    try {
        if(pattern != null) {
            matcher.matches("", pattern); // $NON-NLS-1$
        }
    } catch (Exception e) {
        // NOOP
    }
}
 
開發者ID:botelhojp,項目名稱:apache-jmeter-2.10,代碼行數:16,代碼來源:JMeterUtils.java

示例14: getSentRequestHeaderValue

import org.apache.oro.text.regex.Perl5Matcher; //導入方法依賴的package包/類
private String getSentRequestHeaderValue(String requestHeaders, String headerName) {
    Perl5Matcher localMatcher = JMeterUtils.getMatcher();
    String expression = ".*" + headerName + ": (\\d*).*";
    Pattern pattern = JMeterUtils.getPattern(expression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.SINGLELINE_MASK);
    if(localMatcher.matches(requestHeaders, pattern)) {
        // The value is in the first group, group 0 is the whole match
        return localMatcher.getMatch().group(1);
    }
    return null;
}
 
開發者ID:botelhojp,項目名稱:apache-jmeter-2.10,代碼行數:11,代碼來源:TestHTTPSamplersAgainstHttpMirrorServer.java

示例15: getSampleSaveConfiguration

import org.apache.oro.text.regex.Perl5Matcher; //導入方法依賴的package包/類
/**
 * Parse a CSV header line
 * 
 * @param headerLine
 *            from CSV file
 * @param filename
 *            name of file (for log message only)
 * @return config corresponding to the header items found or null if not a
 *         header line
 */
public static SampleSaveConfiguration getSampleSaveConfiguration(
        String headerLine, String filename) {
    String[] parts = splitHeader(headerLine, _saveConfig.getDelimiter()); // Try
                                                                          // default
                                                                          // delimiter

    String delim = null;

    if (parts == null) {
        Perl5Matcher matcher = JMeterUtils.getMatcher();
        PatternMatcherInput input = new PatternMatcherInput(headerLine);
        Pattern pattern = JMeterUtils.getPatternCache()
        // This assumes the header names are all single words with no spaces
        // word followed by 0 or more repeats of (non-word char + word)
        // where the non-word char (\2) is the same
        // e.g. abc|def|ghi but not abd|def~ghi
                .getPattern("\\w+((\\W)\\w+)?(\\2\\w+)*(\\2\"\\w+\")*", // $NON-NLS-1$
                        // last entries may be quoted strings
                        Perl5Compiler.READ_ONLY_MASK);
        if (matcher.matches(input, pattern)) {
            delim = matcher.getMatch().group(2);
            parts = splitHeader(headerLine, delim);// now validate the
                                                   // result
        }
    }

    if (parts == null) {
        return null; // failed to recognise the header
    }

    // We know the column names all exist, so create the config
    SampleSaveConfiguration saveConfig = new SampleSaveConfiguration(false);

    int varCount = 0;
    for (String label : parts) {
        if (isVariableName(label)) {
            varCount++;
        } else {
            Functor set = (Functor) headerLabelMethods.get(label);
            set.invoke(saveConfig, new Boolean[]{Boolean.TRUE});
        }
    }

    if (delim != null) {
        log.warn("Default delimiter '" + _saveConfig.getDelimiter()
                + "' did not work; using alternate '" + delim
                + "' for reading " + filename);
        saveConfig.setDelimiter(delim);
    }

    saveConfig.setVarCount(varCount);

    return saveConfig;
}
 
開發者ID:johrstrom,項目名稱:cloud-meter,代碼行數:65,代碼來源:CSVSaveService.java


注:本文中的org.apache.oro.text.regex.Perl5Matcher.matches方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。