开发者

how to match all group and subgroup in pcre

a ip or other string, like "11.22.33.44" or "aa.bb.cc.dd". basically, I think it is very easy, (([\d\w]+)+\.)+[\d\w]+ but the problem is which group these submatches are in. not like ip, some string is consist of lots of words+separate

in pcre, I don't know how to 开发者_开发百科extract it all words -- "aa bb cc dd ..."


You need to do like (\w+)\.(\w+)\.(\w+)\.(\w+)

Apparantly, Only perl6 and .net regex can extract subgroups

Note: \w =>[a-zA-Z0-9_]

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜