Greg -- When you're looking for something in particular, it's easy to just look for that specific thing. As you say, Perl has different definitions of what "\n" actually translates to depending on platform and context. So rather than worry about "\n" just have Perl look for what you're actually looking for. :)
That is, a text file from platform X will have certain line-endings, so you can use the \n approach. For a binary file that's platform-independent, seek out dependable codes instead. E.g. $string =~ /([^\012]+)[\012]([^\012]*)/; Finds everything up to the first \012 and stuffs that into $1, then the \012, then everything (including nothing) after that first \012 gets stuffed into $2. Of course, this is Perl, so TMTOWTDI<http://en.wikipedia.org/wiki/There's_more_than_one_way_to_do_it> . Savvy? On Thu, Mar 8, 2012 at 9:35 AM, Greg Aiken <gai...@visioninfosoft.com>wrote: > 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. > > thanks in advance for any help in educating me here, > > greg > > > _______________________________________________ > Perl-Win32-Users mailing list > Perl-Win32-Users@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > > -- "We act as though comfort and luxury were the chief requirements of life, when all that we need to make us happy is something to be enthusiastic about." -- Albert Einstein
_______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs