Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: how to find what's not there with a regex?

by Eimi Metamorphoumai (Deacon)
on Aug 24, 2005 at 13:29 UTC ( [id://486176]=note: print w/replies, xml ) Need Help??


in reply to how to find what's not there with a regex?

Please read How (Not) To Ask A Question. In particular, could you please post some sample data, along with exactly what parts you're trying to extract, and what the criteria are? Reread your question from the point of view of someone who doesn't already know what you want, and I think you'll see that you're leaving out pretty much everything we need to know.

Update: Now there's some data, but still no real specification of how your parameters are separated or what's really going on here. It looks like this may do what you want, but if not you'll have to step back for a moment and think about what you're doing.

#!/usr/bin/perl -l use strict; use warnings; use Data::Dumper; my %variables; undef $/; $_ = <DATA>; while (s/\s*(\w+)\s*=\s*([^=]+)\s*\z//){ $variables{$1} = $2; } print Dumper(\%variables); __DATA__ drsubc = agauss(0, 1, 3) delm1 = '0 + 0.045u*distm1' + delm2 = '0 + 0.07u*distm2' delm3 = '0 + 0.07u*distm3' + delm4 = '0 + 0.07u*distm4' delmt = '0 + 0 +.07u*distmt' delml = '0.16u + 0.43u*distml' delam = '0 +.32u + 0.86u*distam' dele1 = '0 + 0.25u*diste1' + dele2 = '0 + 0.25u*diste2' delma = '0.16u + 0. +6u*distma' pmsxt = 'npmsxt + 12.5u*dpmsxt' ti +h = 0.35u capct = '0.50u + 0.13u*xdcapct' + capcti = '0.55u + 0.13u*xdcapct' m1t = '0.41u + 0. +05u*xdm1t' m1ti = '0.36u + 0.05u*xdm1t' m2t = ' +0.48u + 0.057u*dm2t' m3t = '0.48u + 0.057u*dm3t' + m4t = '0.48u + 0.057u*dm4t' mtt = '0.48u ++ 0.057u*dmtt' qtt = '0.242u + 0.0202u*dqtt' + htt = '0.242u + 0.0202u*dhtt' mlt = '2.0u + 0.2u*dmlt +' amt = '4.0u + 0.4u*damt' e1t = + '3.0u + 0.5u*de1t' e2t = '4.0u + 0.5u*xde1mat' + mat = '4.0u + 0.4u*dmat' m1m2t = '0.35u + +0.05u*dm1m2t'

Log In?
Username:
Password:

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

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

    No recent polls found