Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

regex matching multiple line text

by budik_je_vypnuty (Initiate)
on Mar 06, 2013 at 16:09 UTC ( #1022025=perlquestion: print w/ replies, xml ) Need Help??
budik_je_vypnuty has asked for the wisdom of the Perl Monks concerning the following question:

Dear holy monks, I have a *.h file with C function declarations like this:

const char main ( int foo, char abc)

I tried to match all of them with this regex:

@all_functions = ( $hole_h_file =~ m/^ *[\w ]+\s*\*?\s*[\w]+\s*\(?[\w +\*;,.]+\s*\)/mg );

But that doesnt seems to work :/ How to improve my regex?

Comment on regex matching multiple line text
Select or Download Code
Replies are listed 'Best First'.
Re: regex matching multiple line text (C::Scan)
by Anonymous Monk on Mar 06, 2013 at 16:29 UTC
Re: regex matching multiple line text
by tmharish (Friar) on Mar 06, 2013 at 16:55 UTC

    Use the /s modifier to match across lines

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1022025]
Approved by tmharish
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (12)
As of 2015-07-08 08:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (98 votes), past polls