Gia Glass
Gia Glass

Reputation: 119

Regular expression to find the arguments in a function call

I need to extract the arguments from a function Say, Function_1(arg1,agr2,....argn).

Is it possible to strip the arguments alone with out brackets.

I tried using \([\w,]*\) expression

Upvotes: 1

Views: 2316

Answers (2)

arnep
arnep

Reputation: 6241

If you want to "catch" the matches you need to put braces around them:

 \(([\w,]*)\)

This way you will find everything arg1,arg2 in $1.

Upvotes: 2

gout
gout

Reputation: 812

use this Regular Expression (?<=[\w]*\()[\w,]*(?=\)) to solve the purpose

Upvotes: 1

Related Questions