in reply to Re: need help in extracting lines
in thread need help in extracting lines

I tried this code out and needed to make a change or 2.
-- the /^Table regex needs an 's' trailing modifier.
-- the 'If (tag' condition I changed the 'eq' to '=~', because it turns out that the '[Alias]' line actually ends with a trailing space, and is '[Alias] '.

But the paragraph mode is great! I once used a customer specific language that did list processing in paragraphs, but that was in the 70's. But it is a great processing mode.

It is always better to have seen your target for yourself, rather than depend upon someone else's description.

Replies are listed 'Best First'.
Re^3: need help in extracting lines
by jdporter (Paladin) on Jan 13, 2009 at 21:25 UTC
    /^Table regex needs an 's' trailing modifier

    Depends on what you want in the $table variable. I was intending to get the name of the table, i.e. only what follows 'Table:' on that line. Adding the s modifier would put the entire rest of the paragraph into the variable.

    the '[Alias]' line actually ends with a trailing space, and is '[Alias] '

    In that case, I'd write

    if ( $tag eq '[Alias] ' )
    :-)

    But more importantly, square brackets are special in regular expressions, so you'd want to escape them if you go that route:

    if ( $tag =~ /\[Alias\]/ )

    Between the mind which plans and the hands which build, there must be a mediator... and this mediator must be the heart.