When parsing win/loss scores from ESPN, I notice that the output looks
perfectly normal, even when I carefully inspect the output.

It looks like this:

wloss = /^\w\s\d{1,2}-\d{1,2}/
puts @rows[i][3]
@rows[i][4] = @rows[i][3].scan(wloss)
puts @rows[i][4]

L 31-27 (this is @rows[i][3])
L 31-27 (this is @rows[i][4])
W 32-14    etc....
W 32-14
L 27-14
L 27-14
W 38-22
W 38-22
W 16-13 OT
W 16-13
W 63-14
W 63-14
W 38-35 OT
W 38-35
W 13-10
W 13-10

I scan and keep only the valid data with @rows[i][4]:

If the rows are empty or not in this format, I just return an empty
array.

When I upload this same visible data to my database, it ends up
appearing as:

---
- L 31-27
---
- W 32-14
---
- L 27-14
---
- W 38-22
etc.
etc.

If the row is empty in the database it appears as:

---
- []

So, in my view I end up having to use:

<%=h schedule.winloss.scan(/\w\s\d{1,2}-\d{1,2}/) %>

If I try to sub /---/ out of the line, it does nothing.  I have no idea
why it's showing up there and why the puts output doesn't even show it.
Are these some type of invisible characters that are meant to denote
spaces of some sort?

Any help would be appreciated.  I just want to clean my database so that
it does not show the dashes --- -.
-- 
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to