how to form a regex that will parse the following? -


i need parse following line:

action(x,x,cash(50))action(y,y,material(30,car,2))action(i,i,cash(50)) 

the output should like:

action(x,x,cash(50)) action(y,y,material(30,car,2)) action(i,i,cash(50)) 

the regex used is:

string tokenregex = "(action+\\(([a-za-z]+|\\,|([a-za-z]+\\(\\d*|[a-za-z]+|\\,)\\))+\\))"; 

it fails parse "action(y,y,material(30,car,2))" works "action(x,x,cash(50))". doing wrong. correct regex?

i think it:

string tokenregex = "(action\\([a-za-z]+,[a-za-z]+,[a-za-z]+\\(\\d+(,([a-za-z]+|\\d+))*\\)\\))"; 

i removed parentheses weren't needed grouping in regular expression. if need them capturing parts of expression, you'll have add them back.


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

monitor web browser programmatically in Android? -

c# - Using multiple datasets in RDLC -