   CAtlRegexp and .NET RichTextBox [SOLVED]
  Hi,I'm calling from .NET into a C++ DLL and I'm trying to match a regex using the CAtlRegexp class. That works and I get back the correct matching text as well as the offset and length of the text. However, when I try to select the text in a .NET RichTextBox using the offset and length that was returned, it's off by a number of characters(how many depends on how long the text is, eg for a 24KB block of text it's off by 575 characters). The offset seems to be incorrect even though CAtlRegexp returns the correct matched text, and the length is correct as well.Edit: After testing this with the .NET Regex class, it's giving the same problem. Here's how to reproduce it:1.Take the HTML for the Google.com international homepage and match "<IMG height=110 alt=Google" without the quotes. 2.Put the HTML into the RichTextBox and then call the RichTextBox.Select method passing in the Index and Length of the System.Text.RegularExpressions.Match object.Anyone have any idea what's going wrong?>Edit 2: Found the problem. RichTextBox counts \r\n as one character whereas the regex classes count it as 2. Problem solved.[Edited by - deathtrap on June 18, 2008 5:42:09 PM]