3

I have two types of possible lines to get information from:

<td class="forecast">106.2%</td>

or

<td class="forecast"></td>

And I want to get what is inside, it can be something, like a number, or it can be exactly nothing, not even a white space.

I have the following piece of regular expression:

<td class=\"forecast\">\\s*(.+?)\\s*</td>

It works, when there is content inside the HTML cell, but if there is nothing, it gets the following part of the HTML code.

Does someone knows how to solve this?

f4d0
  • 1,182
  • 11
  • 21

1 Answers1

6

Just change the (.+?) to (.*?).

  • + = One or More
  • * = Zero or More

Added: Regexr

Orel Eraki
  • 11,940
  • 3
  • 28
  • 36
  • Working now. Newbie problems... Thanks so much. – f4d0 Jul 11 '15 at 19:04
  • @Nuno, I'm glad to help. Feel free to Upvote/Accept :) – Orel Eraki Jul 11 '15 at 19:06
  • 1
    I was trying to click on the upper arrow, it says I must have some reputation points first, but now I see I can click also in the check below the down arrow, it told me I can do it in 3 minutes :) – f4d0 Jul 11 '15 at 19:08