java.util.regex.Pattern类表示正则表达式的编译表示。
类声明
以下是java.util.regex.Pattern类的声明 -
public final class Pattern
   extends Object
      implements Serializable
字段
以下是java.util.regex.Duration类的字段 - 
- static int CANON_EQ- 启用规范等价。
- static int CASE_INSENSITIVE- 启用不区分大小写的匹配。
- static int COMMENTS- 允许模式中的空格和注释。
- static int DOTALL- 启用- dotall模式。
- static int LITERAL- 启用模式的文字解析。
- static int MULTILINE- 启用多行模式。
- static int UNICODE_CASE- 启用支持Unicode的案例折叠。
- static int UNICODE_CHARACTER_CLASS- 启用Unicode版本的预定义字符类和POSIX字符类。
- static int UNIX_LINES- 启用Unix行模式。
类方法
| 编号 | 方法 | 描述 | 
|---|---|---|
| 1 | static Pattern compile(String regex) | 将给定的正则表达式编译为模式。 | 
| 2 | static Pattern compile(String regex, int flags) | 将给定的正则表达式编译为具有给定标志的模式。 | 
| 3 | int flags() | 返回此模式的匹配标志。 | 
| 4 | Matcher matcher(CharSequence input) | 创建一个匹配此模式的给定输入的匹配器。 | 
| 5 | static boolean matches(String regex, CharSequence input) | 编译给定的正则表达式并尝试将给定的输入与其匹配。 | 
| 6 | String pattern() | 返回编译此模式的正则表达式。 | 
| 7 | static String quote(String s) | 返回指定String的文字模式String。 | 
| 8 | String[] split(CharSequence input) | 围绕此模式的匹配拆分给定的输入序列。 | 
| 9 | String[] split(CharSequence input, int limit) | 围绕此模式的匹配拆分给定的输入序列。 | 
| 10 | String toString() | 返回此模式的字符串表示形式。 | 
方法继承
该类继承以下类中的方法 -
- Java.lang.Object
						上一篇:
								Java正则表达式MatchResult的接口
												下一篇:
								Java正则表达式Matcher类
												
						
						
					
					
					