Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: how to write multi-line regex

by BrowserUk (Pope)
on Mar 24, 2014 at 04:50 UTC ( #1079482=note: print w/ replies, xml ) Need Help??


in reply to how to write multi-line regex

Try this:

#! perl -slw use strict; $/ = ''; # Paragraph mode while (<DATA>) { if( /TEXT;\s+?LAYER 13[1-7];.+?STRING\s+(\S+)/s ) { print $1; } else{ print "not found!\n"; } } __DATA__ TEXT; LAYER 133; TEXTTYPE 0; PRESENTATION 0,2,0; STRANS 0,0,0; XY 1; X: 91410; Y: 50020; STRING AVDD12; ENDEL; BOUNDARY; LAYER 108; DATATYPE 0; XY 5; X: 0; Y: 0; X: 0; Y: 53530; X: 91410; Y: 53530; X: 91410; Y: 0; X: 0; Y: 0;

Output:

C:\test>junk.pl AVDD12; not found!

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.


Comment on Re: how to write multi-line regex
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (14)
As of 2014-07-24 18:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (165 votes), past polls