Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Balancing Parens

by KM (Priest)
on Jun 01, 2000 at 22:25 UTC ( [id://15878]=note: print w/replies, xml ) Need Help??


in reply to Balancing Parens

Well, I don't know what the real data may look like, but this works for me with your $teststr:

$teststr="blah,blah(blah,blah(blah,blah(blah))),blah"; if ($teststr =~ /^(\w*),(.*?),(\w*)$/) { print "1: $1\n2: $2\n3: $3\n"; }

Cheers,
KM

Replies are listed 'Best First'.
RE: Re: Balancing Parens
by swiftone (Curate) on Jun 01, 2000 at 22:28 UTC
    Ah, I should have been more specific. The real data can have a variable number of elements. Thanks anyway.
      Well, be more specific. Show examples of the actual possible data, no pseudo-data that won't look like the actual data. Give us some test cases.

      Cheers,
      KM

        Okay:

        Acrobatics, P/H, default(DX-6), page(B48) Bicycling, P/E, default(DX-4, SK:Motorcycle), page(B48) Breath Control, M/VH, page(B48) Free Fall, P/A, default(DX-5, HT-5), page(B48) Jumping, P/E, page(B48) Parachuting, P/E, default(DX-4, IQ-6), page(B48) Swimming, P/E, gives(=@max(@int(%Level/10), 1) to Swim), default(DX-4, + ST-5), page(B49)
        These being 4,4,3,4,3,4, and 5 elements respectively.
        The last one is a more complicated one, and the third element should be: gives(=@max(@int(%Level/10), 1) to Swim)
        There is no limit to how many function calls can be embeded (so func1(func2(func3(...funcN()...) )

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://15878]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2024-04-26 06:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found