An engine(引擎) thatperforms(执行) matchoperations(操作) on a
character sequence
byinterpreting(解释) aPattern
.
A matcher is created from a pattern by invoking the pattern'smatcher
method. Once created, a matcher can be used to perform threedifferent(不同的)kinds(种类)
of match operations:
-
The matches
method
attempts(试图) to match the entire(整个的) input sequence against the pattern.
-
The lookingAt
method attempts to match the input sequence, starting at the beginning, against the pattern.
-
The find
method scans the input sequence looking for the next subsequence that matches the pattern.
Each of these methods returns a boolean indicating success orfailure(失败). Moreinformation(信息) about a successful match can be obtained(获得)
by querying the state of the matcher.
A matcher finds matches in a subset(子集) of its input called theregion. By default, theregion(区域)contains(包含)
all of the matcher's input. The region can be modified(修改的) via通过) theregion
method andqueried(查询的)via theregionStart
and regionEnd
methods. The way that the regionboundaries(边界)interact(交互) with some patternconstructs(构造) can be changed.
SeeuseAnchoringBounds
anduseTransparentBounds
for moredetails(详细资料).
This class also defines(定义) methods for replacing matched subsequences with new strings whose contents can, if desired(需要), becomputed(计算) from the match result. TheappendReplacement
andappendTail
methods can be used in tandem(一前一后地) in order tocollect(收集) the result into anexisting(现存的) string buffer, or the more convenient(方便的)replaceAll
method can be used to create a
string in which every matching subsequence in the input sequence is replaced.
The explicit(显式) state of a matcher includes the start and end indices(索引) of the mostrecent(最近的) successful match. It also includes the start and end indices of the input subsequence
captured(捕获) by eachcapturing group in the pattern as well as a total count of such subsequences. As a convenience(方便), methods are also provided(提供) for returning these captured(捕获) subsequences in string form.
The explicit state of a matcher is initially undefined; attempting(尝试)to query any part(部分) of it before a successful match will cause(造成) anIllegalStateException
to be
thrown. The explicit state of a matcher is recomputed(重新计算的) by every match operation.
The implicit(隐式的) state of a matcher includes the input character sequence as well as theappend position(位置), which is initially(开始) zero and is updated by
theappendReplacement
method.
A matcher may be reset(重置) explicitly by invoking itsreset()
method or, if a new input sequence is desired(需要), itsreset(CharSequence)
method. Resetting a matcher discards(丢弃)
its explicit state information(信息) and sets the append position(位置) to zero.
Instances of this class are not safe for use by multiple concurrent threads(多线程并发).
相关推荐
JAVA正则表达式--Pattern和Matcher 现在JDK1.4里终于有了自己的正则表达式API包,JAVA程序员可以免去找第三方提供的正则表达式库的周折了,我们现在就马上来了解一下这个SUN提供的迟来恩物- -对我来说确实如此。...
主要介绍了正则表达式Matcher类中group方法,本文给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下
java正则表达式Pattern,Matcher
java开发必备工具类org.aspectj.matcher.jar。亲测有效
This is a pattern matcher in common lips. We implement the function match with two parameters: a pattern and a fact. It returns a list of variable-value bindings if the facts match the patterns while ...
Java正则表达式:Pattern类和Matcher类
Regex Matcher Chrome正则表达式匹配插件
前端开源库-jest-matcher-deep-close-tojest matcher deep-close,扩展jest以断言具有近似值的数组
前端开源库-jeefo_url_matcherjeefo_url_matcher,jeefo框架的一部分
JAVA正则表达式 Pattern和Matcher,详细说明正则表达式的应用
当然也可以通过扩展/实现yakoo5.matcher.Matcher接口来实现自定义的匹配器,满足业务相关的功能。 《yakoo5.matcher-1.0.zip》压缩包内文件说明: (1)Matcher/dist/yakoo5.matcher-1.0.jar - 编译后的二进制class...
matcher - 简单的通配符匹配
当然也可以通过扩展/实现yakoo5.matcher.Matcher接口来实现自定义的匹配器,满足业务相关的功能。 《yakoo5.matcher-1.0.1.zip》压缩包内文件说明: (1)Matcher/dist/yakoo5.matcher-1.0.1.jar - 编译后的二...
NULL 博文链接:https://chengjianxiaoxue.iteye.com/blog/2428561
JAVA正则表达式Pattern和Matcher
ph-web.zip,具有基本Web功能的Java库和具有通用Web素材的Java库
Signature Matcher使用说明1
Java应用开发必不可少的jar包 org.aspectj.matcher.jar
安装曲线匹配器可以通过NPM或Yarn安装yarn add curve-matcher或者npm install curve-matcher入门curve-matcher的核心是一个名为shapeSimilarity的函数,该函数估计2条曲线的形状彼此之间的相似程度,并返回介于0和1...
基于GMS特征的图像匹配,C++,matlab,python