Re: 'medium' reg exp greediness?
- From: daggerquill@xxxxxxxxx (Jay Savage)
- Date: Sat, 29 Apr 2006 22:10:09 -0400
On 4/29/06, Alan Campbell <alancam73@xxxxxxxxx> wrote:
hello folks,
I'm trying to do a 'medium' greediness regular expression. Here's what I mean. I need to grab all of the DW_TAG_TI_reserved stuff and kill it (italics below)
<die id='0x157'>
<tag>DW_TAG_TI_assign_register</tag>
<attribute>
<type>DW_AT_location</type>
<value>
<block>DW_OP_reg0</block>
</value>
</attribute>
</die>
[snip]
A couple of thoughts: If you read this list regularly, you already
know the advice you're going to get: there are hundreds of xml modules
on CPAN. Use them! Don't reinvent the wheel.
If you really insist on doing this by hand, we need to see more code.
How are you approaching this? On the surface, it looks pretty simple:
{
$lf = "\n";
local $/ = "</die>" . $lf;
whlie (<>) {
print unless /DW_TAG_TI_reserved/;
}
}
Your question, though, leads me to think there's more going on.
So let me just reiterate my original advice again: use a mudule.
HTH,
-- jay
--------------------------------------------------
This email and attachment(s): [ ] blogable; [ x ] ask first; [ ]
private and confidential
daggerquill [at] gmail [dot] com
http://www.tuaw.com http://www.dpguru.com http://www.engatiki.org
values of β will give rise to dom!
- Follow-Ups:
- Re: 'medium' reg exp greediness?
- From: Alan Campbell
- Re: 'medium' reg exp greediness?
- References:
- 'medium' reg exp greediness?
- From: Alan Campbell
- 'medium' reg exp greediness?
- Prev by Date: RE: Replying to the perl list
- Next by Date: match nested tags
- Previous by thread: Re: 'medium' reg exp greediness?
- Next by thread: Re: 'medium' reg exp greediness?
- Index(es):