Why would the following regular expression produce the results below?

****input:
john,doe,"1,200.99",training,12345

****code executed on input:
values = line.split(/("\d*,\d+\.\d*")|,/)

****output:
["john","doe","","1,200.99","","training","12345"]

What's up with the two empty array indexes that are generated during the
split surrounding my dollar value?

The regular expression is pretty explicit and the input string doesn't
contain anything that should cause them when run through the expression,
yet there they are so obviously I'm doing something wrong in my regexp.
Help.
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to