java regex

流程

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
  @Test
  public void testRegex(){
String s = "hel*o";
Pattern pattern = Pattern.compile(s);  // * 创建正则
String source = "helllo helo hello there.";
Matcher m = pattern.matcher(source);   // * 制作Match
int i = 1;
while(m.find()){                       // * 使用 Match  --> 进行正则操作,匹配 find, matches, replaceAll, ....
   System.out.println("m:" + m);
   System.out.println(i + " matched:" + source.substring(m.start(), m.end()));
}

  }

相关类

  • Pattern 类

Org_babel

功能点

switches

  • 方法:

    • -n : 显示行号

代码预览

功能解释:

  • 最终 执行 或者 导出 的代码,并不一定是看到的代码的样子
  • 如果要预览后台真正使用的代码,就需要使用整个功能了

调用方法:

File class

路径分割符

  • File.seperator : "/" or "\"
  • File.pathSeperator: ":" or ";"

当前路径 pwd

File 类

  • 作用: 目录和文件
  • 用途:

    1. 本文件路径的基本操作