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

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.

主站蜘蛛池模板: 利辛县| 沂水县| 菏泽市| 平泉县| 塔城市| 马龙县| 建宁县| 南汇区| 仲巴县| 隆化县| 河池市| 和龙市| 叶城县| 惠东县| 商丘市| 商都县| 上林县| 七台河市| 庆阳市| 黄骅市| 团风县| 盐亭县| 宁波市| 十堰市| 佛坪县| 富民县| 巴彦县| 衢州市| 潜江市| 凤阳县| 太湖县| 南阳市| 三台县| 荔浦县| 柘城县| 奉新县| 繁昌县| 杨浦区| 赞皇县| 泽普县| 阜宁县|