Note that there are some explanatory texts on larger screens.

plurals
  1. PORegEx slows down if text not read from RichTextBox
    primarykey
    data
    text
    <p>I found a strange issue with the combination of RichTextBox and RegEx. If I load a text file into a RichTextBox and use</p> <pre><code>Dim matches As MatchCollection = Regex.Matches(RichTextBox1.Text, "^H(.+\t){10}\n", RegexOptions.Multiline Or RegexOptions.IgnoreCase) </code></pre> <p>then the RegEx will run blazing fast. OTOH if I load the text from a file straight into a string and feed this string with RegEx.Matches using</p> <pre><code>Dim FullText As String = New StreamReader("c:\Temp\TextFile.txt", System.Text.Encoding.UTF8, True).ReadToEnd Dim matches As MatchCollection = Regex.Matches(FullText, "^H(.+\t){10}\n", RegexOptions.Multiline Or RegexOptions.IgnoreCase) </code></pre> <p>then the regex will run for ages.</p> <p>Now obviously the RichTextBox does something to the text. I found that loading the text into the RichTextBox will eliminate the first 4 bytes of the text (is that the byte order mark?). However, trimming those 4 characters with SubString won't solve the problem. RichTextBox does some other processing that I'm unaware of.</p> <p>I'm using RegEx both on client and server side (client can load text files into a RichTextBox to test and setup various RegEx's and the server will process text files according to these previously setup RegEx's). Needless to say that a regex will run blazing fast on the text file loaded into a RichTextBox, while the very same RegEx ran through the very same text file will seem to lock up the server side service.</p> <p>My question: what kind of text processing does the RichTextBox do and how can I mimic the behavior in a server-side process?</p> <p>Thank you for your kind help in advance.</p> <p>Best Regards, Daniel</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload