0

I have an html file that has a table of information and I'm trying to extract specific columns. The pattern is like this with alternating "TableDarkRow" and "TableLightRow":

'>817338284254611</A></td><td Class='TableDarkRow' NOWRAP> 01/14/2011</td>

And I'm trying to extract an array of number and date pairs :

817338284254611
01/14/2011

I tried and came up with this:

>([0-9])+</A>(.*)NOWRAP> ?([0-9]{2}\/[0-9]{2}\/[0-9]{4})

But the (.*) is allowing the entire document to be selected between the first and last occurrences.

3 Answers 3

1

Replace the .* with .*? for non-greedy matching.

Reference: Watch Out for The Greediness!

0
0

Try this one(haven't tested):

/[0-9\/ ]+/
0

You can replace .* with `[A-Za-z'<> \t]+'.

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.