-2

I have been having some quiet days at work and schools out but I wanted to play around with javascript. I'm trying to figure out regular expressions and such. I may be starting out too complicated, I am not too sure.

How hard is it to parse through a table like so (http://gyazo.com/6dc7292f1113201fcc4fe8b5b9e79d7a) and gather the tides for each time of day? For example get the time of 01:45 and see the tide in m is 2.6.

I just want to know the basics of how to grab that variable. Of course tides change from day to day but for now I just want to practice on a static variable.

Thanks, and hopefully this makes sense! I am at the last 2 hours of my 10 hour work day lol!

4
  • 1
    Are you familiar with HTML/CSS?
    – Daemedeor
    Jun 2, 2015 at 0:14
  • 2
    For one, that is not HTML but an image. Yes: GREP could be a solution (minding invoking the wrath of Zalgor), but without the HTML we can't really offer a solution. Also, showing any effort at all may help. But: Welcome to Stack Overflow! Please read the tour!
    – Jongware
    Jun 2, 2015 at 0:17
  • @Jongware I realize it was an image. I took the screenshot off the website because I thought it would be easier to look at. And the table is located on a Fisheries and Oceans Canada website. Example: tides.gc.ca/eng/station?sid=7460 I also realize how vague this is now that I am off work and reading it again.... haha
    – Toombzie
    Jun 2, 2015 at 0:51
  • The answer below actually got me going... Think I might be able to grab it! Thanks for the help guys.
    – Toombzie
    Jun 2, 2015 at 0:53

1 Answer 1

0

That's not what Regular Expressions (shortened to Regex) is normally used for. Regex is to pattern match. like how to read a number if a user entered (808)854-3432 or 808-854-3442. I mean theoretically you could regex but it'd probably be 10000x more complicated then is worth it just to grab one table cell value. ideally you would want to grab the table body and then go through a tr and grab the td corresponding to the cell and parse the time. But looking at that sample table, you won't be having a lot of regular tables for "each time of day". It would go a long way to maybe show some work or what you formulated. I would also recommend code academy, khan academy or any other number of JS tutorials to start, if you haven't already.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.