I'm trying to figure out how I can repeat a capture group on the comma-separated
values in this the following url string:(我试图弄清楚如何在以下URL字符串中的comma-separated
值上重复捕获组:)
id=1,2;name=user1,user2,user3;city=Oakland,San Francisco,Seattle;zip=94553,94523;
I'm using this RegExp
which is return results I want, except for the values since they're dynamic ie.(我正在使用此RegExp
,这是我想要的返回结果,但这些值除外,因为它们是动态的,即。)
could be 2,3,4,etc users in the url parameter and was wondering if I could create a capture group for each value instead of user1,user2,user3
as one capture-group.(可能是url参数中的2、3、4等用户,想知道是否可以为每个值创建一个捕获组,而不是将user1,user2,user3
作为一个捕获组。)
RegExp: (^|;|:)(\w+)=([^;]+)*
(RegExp: (^|;|:)(\w+)=([^;]+)*
)
Here is a live demo of it online using RegExp(这是使用RegExp在线在线演示)
Example Output:(示例输出:)
- Group1 - (semi-colon,colon)(第1组-(分号,分号))
- Group2 - (key ie. id,name,city,zip)(组2-(密钥,即ID,名称,城市,邮政编码))
- Group3 - (value1)(组3-(值1))
- Group4 - (value2) *if exists(组4-(值2)*如果存在)
- Group5 - (value3) *if exists(组5-(值3)*如果存在)
- Group6 - (value4) *if exists(组6-(值4)*如果存在)
etc... based on the dynamic values like I explained before.(等等...基于我之前解释的动态值。)
Question: Whats wrong with my expression I'm using the *
to loop for repeated patterns?(问题:我的表达式在使用*
循环重复模式时出了什么问题?)
ask by Jordan Davis translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…