Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: string parsing with split

by MeatLips (Novice)
on Jan 24, 2011 at 21:27 UTC ( #884006=note: print w/ replies, xml ) Need Help??


in reply to Re: string parsing with split
in thread string parsing with split

This would seem to work if I literally had the word "key" in the string. I was using that as an example. The actual string has different words that are not the same.

Here's something that looks a bit closer to the actual string:

platform=linux hpfFamily=hwseries npsFamily=SWseries rackcnt=1 SPAs=1 SPUpSPA=6 CPUs=6 shrParts="/part1 /home/part2" maintIface="eth2" DEncpSPA=4 nDEncs=4 npsMName="SystemName" portnums="ports=(0 1 2 3)" ints=(eth0 eth1)


Comment on Re^2: string parsing with split
Download Code
Replies are listed 'Best First'.
Re^3: string parsing with split
by BrowserUk (Pope) on Jan 24, 2011 at 21:33 UTC
    Here's something that looks a bit closer to the actual string:

    Then here's something that may be a bit closer to a working solution for you?

    $s = q[platform=linux hpfFamily=hwseries npsFamily=SWseries rackcnt=1 +SPAs=1 SPUpSPA=6 CPUs=6 shrParts="/part1 /home/part2" maintIface="eth +2" DEncpSPA=4 nDEncs=4 npsMName="SystemName" portnums="ports=(0 1 2 3 +)" ints=(eth0 eth1)];; print for split ' (?=\w+=)', $s;; platform=linux hpfFamily=hwseries npsFamily=SWseries rackcnt=1 SPAs=1 SPUpSPA=6 CPUs=6 shrParts="/part1 /home/part2" maintIface="eth2" DEncpSPA=4 nDEncs=4 npsMName="SystemName" portnums="ports=(0 1 2 3)" ints=(eth0 eth1)

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      @a = split ' (?=\w+=)', $s;;

      That was just what I needed! Thank you!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (17)
As of 2015-07-28 20:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (259 votes), past polls