-3

Using Regex, I'm trying to get data from html code, but I don't know how build it, without using any html tags.
I have some string (item-desc), and count of symbols after this string, which must be my data.
Something like: in item-desc12345abcde, I'm using regex with value of 6 symbols, and i got 12345a. This expression give me only 1 symbol after my string:

Regex itemInfoFilter = new Regex(@"item-desc\s*(.+?)\s*>", RegexOptions.Compiled | RegexOptions.IgnoreCase);
  • Your question is very unclear. Please clarify what you're asking and add relevant samples of data (minimal necessary information to understand your question). – CoolBots Feb 09 '17 at 06:45

2 Answers2

1

I don't recommend using regular expressions to parse HTML.

Use an HTML parser instead:

HTML Agility Pack

Zesty
  • 2,922
  • 9
  • 38
  • 69
0

From what I understand of your question I think this should work: item-desc(.){6}(?=[\s'"])

In the code I assume that your string ends with a space (\s), ' or "

Hope this helps

hakany
  • 7,134
  • 2
  • 19
  • 22