mercredi 23 novembre 2016

Matching parameters of a function with Regex

What I have so far: \w+\(((".+")|(\d+))+\)
I'm not sure how to go about matching more than one paramter separated by a comma. How can I capture the parameters (and function names) of the following test cases?

scroll("foo")
scroll("foo",55)
scroll("foo","bar")
scroll("foo","bar",55)
scroll(55)
scroll(55,"foo")
scroll(55, 13,"foo","bar")

For example, in the last one the groups must be scroll, 55, 13, "foo", and "bar".

Edit: Language is AS3

Aucun commentaire:

Enregistrer un commentaire