Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Re: Re: More Regular Expressions (text data handling)

by frankus (Priest)
on Dec 04, 2001 at 20:39 UTC ( #129359=note: print w/replies, xml ) Need Help??

in reply to Re: Re: More Regular Expressions (text data handling)
in thread More Regular Expressions (text data handling)

As I see it, you require the use of forward lookaheads in a regex:

Since the line before Number contains the name and the persons details are terminated again by name,
something that grabs the name and the text between two instances of the name can be got.

You could then make a hash of names with the value being a hash of details, does that sound good?


Brother Frankus.


  • Comment on Re: Re: Re: More Regular Expressions (text data handling)

Replies are listed 'Best First'.
Re: Re: Re: Re: More Regular Expressions (text data handling)
by graq (Curate) on Dec 04, 2001 at 20:51 UTC
    The Number is the unique key for the data.
    Having written this problem down, and examined it as I try to explain it :), I have decided to attempt this approach:
    1. Remove all blank lines.
    2. Find the index and grab 70 lines (-2..68).
    3. Split the data into three sections.
    4. Deal with section overlaps.
    The three sections are:
    1. All lines up to (but excluding) the first line with a colon.
    2. All lines with a colon.
    3. The rest.
    Count 'The rest' and move that many lines from section 2 into (preceding) section 3.

    This should help sort the data.

    <a href="">Graq</a>

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://129359]
[Discipulus]: more or less Corion: the monastery was so calm, maybe too much! i feared you'v lost in VR
[Discipulus]: choroba can i ask why you used *DATA{IO}?
[Corion]: Discipulus: Aaah, no, while I'm working on connecting the VR libraries to Perl, I'm not lost there ;) Although I watched The Matrix with a friend in London ;)

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2016-12-06 08:29 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (101 votes). Check out past polls.