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

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.

主站蜘蛛池模板: 宿松县| 长寿区| 隆德县| 轮台县| 邢台县| 北海市| 嵊泗县| 志丹县| 阿城市| 安顺市| 泗洪县| 清新县| 南投县| 铜鼓县| 习水县| 略阳县| 察哈| 石首市| 保定市| 清水河县| 诏安县| 长宁县| 琼结县| 克拉玛依市| 徐汇区| 新津县| 喜德县| 东阿县| 浙江省| 阜平县| 景洪市| 昌邑市| 固镇县| 永州市| 洞头县| 屯留县| 蒙山县| 吴江市| 拜城县| 牙克石市| 勐海县|