术语简介

Pattern的方法如下: static Pattern compile(String regex)

将给定的正则表达式编译并赋予给Pattern类

static Pattern compile(String regex, int flags)

同上,但增加flag参数的指定,可选的flag参数包括:CASE INSENSITIVE,MULTILINE,DOTALL,UNICODE CASE, CANON EQ、

flags参数是一个位掩码,并在Pattern类中定义为int常量。[1]

int flags()

返回当前Pattern的匹配flag参数.

Matcher matcher(CharSequence input)

生成一个给定命名的Matcher对象

static boolean matches(String regex, CharSequence input)

编译给定的正则表达式并且对输入的字串以该正则表达式为模开展匹配,该方法适合于该正则表达式只会使用一次的情况,也就是只进行一次匹配工作,因为这种情况下并不需要生成一个Matcher实例。

String pattern()

返回该Patter对象所编译的正则表达式。

String[] split(CharSequence input)

将目标字符串按照Pattern里所包含的正则表达式为模进行分割。

String[] split(CharSequence input, int limit)

作用同上,增加参数limit目的在于要指定分割的段数,如将limi设为2,那么目标字符串将根据正则表达式分为割为两段。

相关查询:
最新查询:quantum concentrate PropertyVetoException Manufacturing improved services decides especially Records conceive Recordset HISTORY globalization Propelled connected flat-worm creating Scheele Colburn Vandersall Optical electro Telefonica Nlsfunc Halogen Prophoca technology Exquisite Prodigy squeezed effects Guilder fication Mathematical Peruvian capitulum Coupling Study Reading Sherpath flotation surface squeezing principles Filmore Knightmare Flamenca component Windows ProCAST thread- Extralight Unitree Explorer gradient Judgment Semantics Emphasis Collateral Exposition Locksmith software ClinicalKey Integration Radisson Micro-USB explicit efficiency Fastopen OpenMobileTerminalPlatform RAZORBACK Project persistent parallel Interface Principles exploit ScienceDirect ColorStone unsigned Pattern
友情链接: 知道 电影 百科 好搜 问答 微信 值得买 巨便宜 天天特价 洛阳汽车脚垫 女装 女鞋 母婴 内衣 零食 美妆 汽车 油价 郑州 北京 上海 广州 深圳 杭州 南京 苏州 武汉 天津 重庆 成都 大连 宁波 济南 西安 石家庄 沈阳 南阳 临沂 邯郸 保定 温州 东莞 洛阳 周口 青岛 徐州 赣州 菏泽 泉州 长春 唐山 商丘 南通 盐城 驻马店 佛山 衡阳 沧州 福州 昆明 无锡 南昌 黄冈 遵义
© 2026 haodianxin 百科 豫ICP备14030218号-3 消耗时间:0.004秒 内存0.84MB