Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Problems with formatting the results of my regex

by 2teez (Priest)
on Jul 07, 2012 at 07:04 UTC ( #980450=note: print w/ replies, xml ) Need Help??


in reply to Problems with formatting the results of my regex

OR you could use this, if you want:

while(...){ chomp; if (m{([[:digit:]].+?);.+?$tags[0].+?=.+?((-)?[[:digit:]].+?)$}s) +{ printf "%s,%s\n", $1, $2; } .... }
UPDATE:
why use '.*' after $2 i.e (\-?\d+.?\d*).*/. Your code will still hav +e worked as (\-?\d+.?\d*) for your $2.


Comment on Re: Problems with formatting the results of my regex
Select or Download Code
Re^2: Problems with formatting the results of my regex
by monsoon (Monk) on Jul 07, 2012 at 07:21 UTC
    How does your regex not match a \r?
    $_ = "20120704 00:05:53.46;CmdTask(0);EV;FBLdxPreAlignment rtn=0, Yoff +set=-4278\r"; $tag[0] = "FBLdxPreAlignment"; if (m{([[:digit:]].+?);.+?$tags[0].+?=.+?((-)?[[:digit:]].+?)$}s) +{ printf "%s,%s,,,,,,\n", $1, $2; }
    output:
    ,,,,,,04 00:05:53.46,-4278
Re^2: Problems with formatting the results of my regex
by superwombat (Initiate) on Jul 07, 2012 at 08:13 UTC
    I put the trailing ".*" on the end to attempt to capture whatever end of line symbol was thwarting me. It's completely not needed.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (17)
As of 2014-04-16 14:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (428 votes), past polls