-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Description
English:
Lookbehind and lookahead (also called lookaround) are specific types of
non-capturing groups (used to match the pattern but not included in matching
list). Lookarounds are used when we have the condition that this pattern is
preceded or followed by another certain pattern. For example, we want to get all
numbers that are preceded by$
character from the following input string
$4.44 and $10.88
. We will use following regular expression(?<=\$)[0-9\.]*
which means: get all the numbers which contain.
character and are preceded
by$
character.
Chinese translation:
先行断言和后发断言都属于非捕获簇(不捕获文本 ,也不针对组合计进行计数)。
先行断言用于判断所匹配的格式是否在另一个确定的格式之前,匹配结果不包含该确定格式(仅作为约束)。
例如,我们想要获得所有跟在
$
符号后的数字,我们可以使用正后发断言(?<=\$)[0-9\.]*
。
这个表达式匹配$
开头,之后跟着0,1,2,3,4,5,6,7,8,9,.
这些字符可以出现大于等于 0 次。
The example input string $4.44 and $10.88
does not occur in the chinese translation.