0

This is my Regex:

private static Regex _errorRegex = new Regex(" <div class=\"styleRed\">(?<message>.*?)</div>", RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Compiled);

and the webpage has data like:

<div class="styleRed">• Zero is required in the Consideration Field for Deed Type CEDOT (Row 1). </div><div class="styleRed">• Zero is required in the Assume/Value Field for Deed Type CEDOT (Row 1). </div>


var matches = _errorRegex.Matches(webpage);

the matches count is always 1. Any idea what am I missing?

Jack
  • 7,433
  • 22
  • 63
  • 107

1 Answers1

3

Your regex pattern starts with a space.

In your example, the second div on the HTML page doesn't have a space before it.

Hence, it doesn't match.