From: [email protected] 
[mailto:[email protected]] On Behalf Of Greg 
Aiken
Sent: 08 March 2012 15:36
To: [email protected]
Subject: Fwd: perl pattern match option 's' (coerce . to include \n)

> hello all,
>
> i read how one may include 's' at end of a pattern match to essentially 
> redefine '.' to include the 'newline
> character'.
>
> today i found a code fragment whereby someone presents how they extract flate 
> encoded streams from pdf files
> using a regex whereby he is using the 's' option.
>
> the problem is that for the particular test pdf file i am trying to process, 
> the definition of 'newline' is
> only (hexOD)
>
> in general, i read that the definition of 'newline' may vary by os, to be 
> either of several values:
> (hex0D)(hex0A) windows
> (hexOD) as in the case of this particular pdf file, or
> (hexOA) for some other operating systems
>
> so is there a way one can go one step further to not only use the 's' pattern 
> match option, but to then also
> define what the actual definition of 'newline' is supposed to be - so as to 
> guarantee a match of what you are > intending to match?
>
> i am familiar with 'input line seperator' $/ (which would be used for reading 
> input from files), and with
> 'output line seperator' $\ (which would be used for - print "something\n", as 
> in writing to files).  but ive
> never heard of the 'pattern matching seperator' - which i think i would need 
> in this case.

Without the /s modifier, . matches any character except \n. With the /s 
modifier, . matches any character including \n. So, unless you need to capture 
the newlines, why would you care?

HTH


--
Brian Raven




Please consider the environment before printing this e-mail.

This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient or have received this e-mail in error, please advise 
the sender immediately by reply e-mail and delete this message and any 
attachments without retaining a copy.

Any unauthorised copying, disclosure or distribution of the material in this 
e-mail is strictly forbidden.
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to