Skip to main content


Showing posts from 2011

Asynchronous Regex Matching and Highlighting

I came across a question on StackOverflow the other day where someone was trying to find the culprit for an unusually slow running regular expression. In fact it'd take around 30 seconds to execute. This was a rather extreme case of catastrophic backtracking . With just a few minor tweaks someone was able to drastically improve the performance, making it about 48,000 times faster. Yeah, pretty drastic and it really illustrates the importance of running a simple benchmark to test any regular expression that'll see heavy use. It's rare that someone will write such a poor performing regular expression, especially by accident. But nevertheless, this circumstance is one where Regex Hero failed miserably. The trouble is that the regular expression was evaluated synchronously as you type. So if you're dealing with a slow running regular expression, this would actually hang the UI temporarily until it's finished. It was an ugly thing. But no more. As of today,

Alternating highlighting, new string copy options, and more

Alternating Highlighting I got some great feedback recently. First, magneticmail on GetSatisfaction suggested that I create two colors for Regex Hero's highlighting : an odd color and an even color. This had crossed my mind before but I hadn't really given it much thought. My initial concern is that introducing a new color could cause some confusion. What does the color mean? But after thinking about it, implementing it, and playing with it myself, I think it's simple enough. Once you actually write an expression that has 3 or more matches, it becomes obvious that the two colors simply alternate to provide some visual distinction. And the value that the visual distinction brings with it outweighs any potential confusion, I believe. So, thank you magneticmail for the suggestion. It's a simple change, but hopefully a change for the better. Let me know what you guys think in the comments. Move to target string and start a new expression This idea came from

Skype Screen Sharing with Steve

I've had good Regex Hero feedback slowly trickle in through GetSatisfaction, email, and a few phone calls over the past couple years. It's great to hear from you guys as I've been made aware of problems that I never knew I had. And so in the spirit of improving Regex Hero , I want to try something new. I'm inviting all Regex Hero fans to contact me via Skype for a 30 minute one-on-one screen sharing session. This will be an opportunity for me to learn about problems you're having with Regex Hero and help out any way I can. Perhaps you're having trouble figuring out how to do something very specific in Regex Hero. It could be that a feature is missing, or simply isn't as obvious as it should be. Or perhaps you're having trouble with a regular expression and just need a little help. In either case, you'll share your screen with Regex Hero open as we dive into it. Email me if you're interested and we'll set up a time. What you'

Bug fixes around undo/redo and copy/paste

I found a report of a case recently where Regex Hero would sporadically cause Chrome to crash. It was in a comment on StackOverflow, and I'm lucky to have found it. I didn't have much to go on, but I take reports like this seriously. First of all, I had never seen this actually happen before. But I began by banging on things trying to make anything and everything break that I possibly could. My method is perhaps a bit crude and it simply takes time and some knowledge of what's going on in the code to get anywhere. Here's what I managed to fix, in order of discovery: There was a layout problem involving the minimum vertical height of Regex Hero. After you shrink the window beyond a certain point a scroll bar appears so as not to fold the UI on top of itself. Well there was a logic problem in this calculation which could actually throw an error in certain circumstances. The error was being trapped though, and couldn't have caused the crash. The expand/c

Bug fixes concerning tabs and syntax highlighting

The tab spacing bug This problem stems from a bug in the RichTextBox. Basically, the tab spacing in the RichTextBox is inconsistent and very strange. Sometimes a tab will be bigger than a space, and sometimes it'll be smaller than a space. I have informed Microsoft of the bug and I'm hoping they'll fix it for Silverlight 5. What this means for Regex Hero is that tabs would throw the highlighting out of alignment. So my fix was to override tabs with spaces. I had made this change weeks ago. But today's release has this same treatment on pasting tabbed text . This isn't ideal and basically means the \t regular expression will never match anything in Regex Hero. If I can find a better workaround I will do it. But at least today's fix means that the yellow highlighting will always be in alignment and is reliable again. To help ensure Microsoft fixes this bug in the RichTextBox in a timely manner, you can help by up-voting the bug here on MS Conn

Syntax Highlighting

Syntax Highlighting This feature was requested back in 2009. I didn't do it back then because I wasn't sure how I was going to do everything I wanted with it. Ever since the beginning I've always said that if I can't implement a feature right, then I wouldn't bother with it. But I've learned since then and this week I gave it a try.  It took a little experimenting to find the right approach, but I'm pleased with the end result. The syntax highlighter is built off of my existing parsing engine. In addition to highlighting basic constructs, it'll also detect unclosed parenthesis or brackets and paint them red. So for example (abc(def) would all be red.  I think this makes it easier to find mistakes. And I hope you enjoy it. In addition to this I've fixed a few bugs and made a few improvements: I improved code completion when working with a multi-line regular expression. The down arrow key now responds more like you'd expect a good cod