I want to use a regular expression to search for an unknown number of arguments in a string. I think that if I explain, it will be difficult, so let's just look at an example:
Regular expression: @ISNULL\('(.*?)','(.*?)','(.*?)'\)
String: @ISNULL('1','2','3')
Result:
Group[0] "@ISNULL('1','2','3')" at 0 - 20
Group[1] "1" at 9 - 10
Group[2] "2" at 13 - 14
Group[3] "3" at 17 - 18
This works great. The problem begins when I need to find an unknown number of arguments (2 or more).
What changes do I need to make for the regex to find all the arguments that will occur in the string?
So, if I parse this line "@ISNULL('1','2','3','4','5','6')", I will find all the arguments.
source
share