Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
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 (Pilgrim) 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 (Novice) 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 studying the Monastery: (11)
As of 2015-07-03 18:27 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 (55 votes), past polls