in reply to Regular expression to match text between two tags (was: Help!! Regular Expressions)

Mastering regular expressions is indeed a good book, but I've heard it called dated by quite a few people. Probably what you want to do in this circumstance is something that you should rarely do, and that is tinker with $/. In this case, I suspect this shall suffice:
my $lineterm = $/; $/ = ''; my $thingy = $_ =~ /:::(.*):::/; $/ = $lineterm;
I dont believe perl's regexes behave like sed(1) or awk(1)'s in that they require flags and modifiers to catch newlines. More information on the tricky $/ is of course in perlvar.

and of course you should read that book cover to cover. it is extremely helpful. I learned a great deal from that book.

brother dep.

update: me and my itchy trigger finger. well i just spoke to dws in the chatterbox, and while i wasnt able to test this out, he was. apparently the re engine (at least as recently as 5.6) does not care what $/ is set to for the end-of-line character. which means this node isnt quite worthless because, yay, it taught me something. *grumble*

--
Laziness, Impatience, Hubris, and Generosity.

Replies are listed 'Best First'.
Re: Re: Help!! Regular Expressions
by suaveant (Parson) on Apr 12, 2001 at 16:29 UTC
    It may not have the latest RE stuff... but it really covers the basics, which, really, isn't that what most people need? Granted a new chapter on perl would be nice, but a lot of the stuff in that book won't be dated until real changes are made to the core of Regular Expressions
                    - Ant