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

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.

主站蜘蛛池模板: 苍南县| 扶风县| 健康| 大港区| 哈尔滨市| 定襄县| 阿鲁科尔沁旗| 得荣县| 宽城| 哈密市| 浦北县| 夏邑县| 长葛市| 寿宁县| 梅河口市| 南投县| 紫云| 金山区| 遵义县| 垣曲县| 大宁县| 德州市| 新绛县| 石首市| 潮州市| 布尔津县| 舒兰市| 赤水市| 绥阳县| 通江县| 旺苍县| 紫阳县| 奇台县| 河西区| 喀什市| 大余县| 安溪县| 西丰县| 梨树县| 保亭| 博罗县|