0

I've been trying to do this for a few hours now without luck. I've tried several RegExp patterns but here I am, asking for help now. This is the text

 <span class="bold">Life:</span>
                                    </div>
                                    10200 / 10200                                </li>
                                <li>

What I'm trying to get is 10200 / 10200. I haven't had any luck. I'm trying to do this in C# by the way. Any help would be highly appreciated, thanks a lot!

  • Use a DOM-parser to parse and get content from HTML. RegExes are not made for HTML. – knittl Sep 21 '14 at 17:53
  • I have to do this using RegEx. – user2467120 Sep 21 '14 at 17:55
  • 2
    Says who? Use the right tool for the right job. And regular expressions are not the right tool for parsing HTML. – knittl Sep 21 '14 at 17:57
  • Beware, this [could lead to severe sickness](http://stackoverflow.com/a/1732454/3764814). Or just use the `(\d+)\s*/\s*(\d+)` regex. :) – Lucas Trzesniewski Sep 21 '14 at 18:21
  • What exactly do you want? If you want the contents of a HTML tag, use a HTML parser. If you want to extract text like "number / number", use regex. If you want "10200 / 10200", use "return "10200 / 10200"". – Aran-Fey Sep 21 '14 at 18:40

1 Answers1

0

Regex is not the best tool but you can use this:

(?sx)
(?<=
   <span class="bold">Life:</span> \s* </div> \s*
)
[^<]+
walid toumi
  • 2,172
  • 1
  • 13
  • 10