org.crsh.util.Utils.globexToRegex()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(149)

本文整理了Java中org.crsh.util.Utils.globexToRegex()方法的一些代码示例,展示了Utils.globexToRegex()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.globexToRegex()方法的具体详情如下:
包路径:org.crsh.util.Utils
类名称:Utils
方法名:globexToRegex

Utils.globexToRegex介绍

[英]Create a pattern that transforms a glob expression into a regular expression, the following task are supported

    • : Match any number of unknown characters
  • ? : Match one unknown character
  • [characters] : Match a character as part of a group of characters
  • \ : Escape character
    [中]创建将glob表达式转换为正则表达式的模式,支持以下任务
    **:匹配任意数量的未知字符
  • ? : 匹配一个未知字符
    *[字符]:将一个字符作为一组字符的一部分进行匹配
    *\:转义字符

代码示例

代码示例来源:origin: crashub/crash

public static List<BindingRenderer.BindingData> lookup(List<String> filters, String name, Boolean verbose) {
 Pattern pattern = null;
 if (name != null) {
  pattern = Pattern.compile("^" + Utils.globexToRegex(name) + "$");
 }
 List<BindingRenderer.BindingData> data = new ArrayList<BindingRenderer.BindingData>();
 data.addAll(get(filters, pattern, verbose, ""));
 data.addAll(get(filters, pattern, verbose, "java:/"));
 data.addAll(get(filters, pattern, verbose, "java:comp/env/jdbc"));
 data.addAll(get(filters, pattern, verbose, "java:jboss"));
 data.addAll(get(filters, pattern, verbose, "java:global"));
 data.addAll(get(filters, pattern, verbose, "java:app"));
 data.addAll(get(filters, pattern, verbose, "java:module"));
 return data;
}

代码示例来源:origin: crashub/crash

private void assertNotMatchGlob(String test, String globex) {
 Pattern p = Pattern.compile("^" + Utils.globexToRegex(globex) + "$");
 Matcher matcher = p.matcher(test);
 assertFalse("Was expecting " + test + " to not match " + globex, matcher.matches());
}

代码示例来源:origin: crashub/crash

private void assertMatchGlob(String test, String globex) {
 Pattern p = Pattern.compile("^" + Utils.globexToRegex(globex) + "$");
 Matcher matcher = p.matcher(test);
 assertTrue("Was expecting " + test + " to match " + globex, matcher.matches());
}

代码示例来源:origin: org.crsh/crsh.shell.core

public static List<BindingRenderable.BindingData> lookup(List<String> filters, String name, Boolean verbose) {
 Pattern pattern = null;
 if (name != null) {
  pattern = Pattern.compile("^" + Utils.globexToRegex(name) + "$");
 }
 List<BindingRenderable.BindingData> data = new ArrayList<BindingRenderable.BindingData>();
 data.addAll(get(filters, pattern, verbose, ""));
 data.addAll(get(filters, pattern, verbose, "java:/"));
 data.addAll(get(filters, pattern, verbose, "java:comp/env/jdbc"));
 data.addAll(get(filters, pattern, verbose, "java:jboss"));
 data.addAll(get(filters, pattern, verbose, "java:global"));
 data.addAll(get(filters, pattern, verbose, "java:app"));
 data.addAll(get(filters, pattern, verbose, "java:module"));
 return data;
}

代码示例来源:origin: org.crashub/crash.shell

public static List<BindingRenderer.BindingData> lookup(List<String> filters, String name, Boolean verbose) {
 Pattern pattern = null;
 if (name != null) {
  pattern = Pattern.compile("^" + Utils.globexToRegex(name) + "$");
 }
 List<BindingRenderer.BindingData> data = new ArrayList<BindingRenderer.BindingData>();
 data.addAll(get(filters, pattern, verbose, ""));
 data.addAll(get(filters, pattern, verbose, "java:/"));
 data.addAll(get(filters, pattern, verbose, "java:comp/env/jdbc"));
 data.addAll(get(filters, pattern, verbose, "java:jboss"));
 data.addAll(get(filters, pattern, verbose, "java:global"));
 data.addAll(get(filters, pattern, verbose, "java:app"));
 data.addAll(get(filters, pattern, verbose, "java:module"));
 return data;
}

代码示例来源:origin: com.github.corda.crash/crash.shell

public static List<BindingRenderer.BindingData> lookup(List<String> filters, String name, Boolean verbose) {
 Pattern pattern = null;
 if (name != null) {
  pattern = Pattern.compile("^" + Utils.globexToRegex(name) + "$");
 }
 List<BindingRenderer.BindingData> data = new ArrayList<BindingRenderer.BindingData>();
 data.addAll(get(filters, pattern, verbose, ""));
 data.addAll(get(filters, pattern, verbose, "java:/"));
 data.addAll(get(filters, pattern, verbose, "java:comp/env/jdbc"));
 data.addAll(get(filters, pattern, verbose, "java:jboss"));
 data.addAll(get(filters, pattern, verbose, "java:global"));
 data.addAll(get(filters, pattern, verbose, "java:app"));
 data.addAll(get(filters, pattern, verbose, "java:module"));
 return data;
}

相关文章