Regex - Capturing a Repeated Group

后端 未结 3 1913
死守一世寂寞
死守一世寂寞 2021-01-15 20:49

Alright, I\'ve read the tutorials and scrambled my head too much to be able to see clearly now.

I\'m trying to capture parameters and their type info from a function

3条回答
  •  不思量自难忘°
    2021-01-15 21:21

    the page you referenced mentioned using ?: for non-capture, then surrounding the repeating capture in its own group. i am guessing they are suggesting something like this function\(((?:(\/\*(?[a-zA-Z]+)\*\/)?(?[0-9a-zA-Z_$]+),?)*)\)

    i like to use http://gskinner.com/RegExr/ to test my expressions, but it won't show repeated captures. You may have to loop through the results in whatever return structure you get back to see the values in other non-.NET languages.

    sorry i couldn't test more thuroughly...

提交回复
热议问题