官术网_书友最值得收藏!

Eager matching

At this point, it is important to understand one important behavior of regular expression engines, called eagerness. A regular expression engine performs a match operation from left to right in an input string. While matching a regex pattern against the input string, the regex engine moves from left to right and is always eager to complete a match, even though there are other alternative ways in the regular expression to complete the match. Once a substring is matched, it stops proceeding further and returns the match. Only when a character position fails to match all the possible permutations of the regular expression, then the regex engine moves character by character to attempt a match at the next position in the input string. While evaluating a regex pattern, the regex engine may move backwards (backtrack) one position at a time to attempt matching.

主站蜘蛛池模板: 伊春市| 灌云县| 威远县| 青田县| 武平县| 兴和县| 汝南县| 沛县| 彭山县| 苗栗市| 德令哈市| 河北省| 鄂托克旗| 云林县| 奎屯市| 朔州市| 田东县| 休宁县| 化德县| 韶关市| 浠水县| 霍山县| 岳普湖县| 玛纳斯县| 鹰潭市| 廊坊市| 邵阳市| 沙田区| 临沭县| 永靖县| 喀喇| 绍兴县| 田林县| 北海市| 谢通门县| 从化市| 阳江市| 保山市| 靖州| 正镶白旗| 微山县|