RE: Need to extract only the function name no brackets reqd.




Jeff,

It is returning just 1.I think the result of the expression.
-----Original Message-----
From: Jeff Pang [mailto:pangj@xxxxxxxxxxxxx]
Sent: Friday, March 30, 2007 2:53 PM
To: Nath, Alok (STSD); beginners@xxxxxxxx
Subject: Re: Need to extract only the function name no brackets reqd.


I have this program which extract function names from the files.
My only problem is I want to extract only the function names{no
brackets () needed } .
Currently its extract all words after word sub but it all
returns
the parentheses after that.


Hello,

Given the function definition like below,

sub myfunc($,$){
....
}


You may extract the function name using the regex,

my ($func_name) = $_ =~ /sub\s+(\w+)/;

or even,

my ($func_name) = /sub\s+(\w+)/;

The 'split' is not needed I think.
.



Relevant Pages

  • Re: Need to extract only the function name no brackets reqd.
    ... My only problem is I want to extract only the function names{no ... brackets needed}. ... Currently its extract all words after word sub but it all ... You may extract the function name using the regex, ...
    (perl.beginners)
  • RE: Extract the desired value from a regex
    ... Extract the desired value from a regex ... property of Persistent Systems Ltd. ... Systems Ltd. does not accept any liability for virus infected mails. ...
    (perl.beginners)
  • Re: Regex question
    ... structure of the date you're trying to extract. ... For example, in Regex you can ... pattern that will ensure a valid date within the range allowed by T-SQL ... valid date from a string. ...
    (microsoft.public.dotnet.languages.csharp)
  • regular expression extracting groups
    ... I'm trying to use regular expressions to help me quickly extract the ... regex groups that I can easily access later. ... the key/value pairs but it ends up with only the contents of the last ... GROUP_SCHEMA = 'schema' ...
    (comp.lang.python)
  • Extracting Name Value Pairs
    ... Hi I have a long line of text that I want to parse for name/value pairs ... can i use RegEx to extract name value pairs? ... A resource for the Microsoft Dynamics Community ...
    (microsoft.public.scripting.vbscript)