简体   繁体   中英

c# Regex repeat group and split comma

I have a pattern like this ((1), (2), (3), ....)

And I started to create a regex to match this pattern.

\(\(\d+\)\)

This patternt matches only ((2)) pattern but I want to continue with comma, and repeat the group pattern like this: ((1), (2), (3), ....)

How can I do?

若要匹配整个输入行,请使用以下表达式: \\((\\(\\d+\\)|\\,\\s?)+\\)

The following regex will match entire pattern:

\((?:\(\d+\))(?:,\s\(\d+\))*\)

Regex101

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM