From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Greg Aiken Sent: 08 March 2012 15:32 To: perl-win32-users@listserv.activestate.com Subject: pattern match 'or' operator |
> in pdf files evidently there are two different ways one may specify the > 'length' operator > > sometimes one sees; > \Length > > while at other times, the letter L is sufficient; > \L > > i am wanting to do a pattern match for a line of data in a pdf file where i > am looking to match EITHER \L or > \Length > > is there a way that using ONE pattern match I can say achieve something like > this? > > in pseudo code: > $record =~ /'Length' | 'L'/ > (where the precedence would be towards the first thing matched, in this case, > 'Length') > > the only example ive seen which uses the or operator (|), shows this working > for a single character only, as > in: > $record =~ /a|b/ > > ive never seen an example quite like what I would like to do... > > if it cant be currently done, perhaps a future enhancement to regex could be > in order, by adding a new > enclosing 'literal delimiter', something like this could one day work > (forgive me here, im just thinking > outside of the box - only as i dont know any better); > > $record =~ /'Length' | 'L'/ > > thanks for helping me with my understanding of this. Assuming trailing white space, then qr{\\L(ength)?\b} should match both. However, depending on what you are trying to achieve, it might be advisable to use a module that knows how to parse PDF files. 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 Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs