1

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

2
  • 1
    I assume you want to parse the source code somehow? Commented Jun 26, 2012 at 7:13
  • Argument, as in passed to a function call, OR is it parameter of a function? Commented Jun 26, 2012 at 7:18

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Yeah.. much simpler , u will get it in the first group.
1

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

2 Comments

What language have you tested this on?
The answer is using variable-width look-behind, which is only supported in C#. stackoverflow.com/questions/3159524/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.