正则表达式中:括号中的括号

正则表达式"([a-z]+)(=)(([a-z]+)\\s+([a-z]+))"中有内嵌括号,那么在match之后,group总个数和group序是怎么安排的?

来例示吧。让原文 = "name=kent chen",则在match之后,

groupCount = 5

$1 = "name"

$2 = "="

$3 = "kent chen"

$4 = "kent"

$5 = "chen"

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.