Skip to main content

Posts

"Redo" on a Mac, and a Group Name Warning

Today I released a minor update, fixing a couple bugs: "Redo" functionality now works as it should on a Mac via the Command-Shift-Z keyboard shortcut. I've added a group name warning.  There's a weird issue with the way the .NET Regex engine allows numeric entries in group names.  For instance (? abc)| (? def)  will not throw an error upon instantiation.  However, when you enumerate through the groups that's when you get a runtime error.  So I've added a rule to show a warning in this case that says, "Group names must begin with a word character, or if they're numeric they cannot have gaps between numbers."

C# Strings and Code Generation Bug Fixed

It was brought to my attention yesterday that there was a bug with the C# code generation feature inside Regex Hero.   Thanks Blake for pointing it out .  It turns out that I had made a stupid mistake in the way I was adding \r and \n to the string.  I mostly rely on the @"string" literals because they're convenient and generally cleaner for what I need to do.  But of course, the escaped notations \r and \n don't work inside those strings. So this has been updated this morning.  From now on Regex Hero will generate C# strings more like this... @"line1" + "\n" + @"line2"

Optimized Memory Consumption

Today's update includes a minor change to the custom undo/redo system in all of the textboxes within Regex Hero.  They will now only store history on the OnKeyUp event, rather than storing history for every change.  In other words, if you hold down a key on the keyboard for a long time it's not going to store history for every single character individually anymore. This is a subtle difference, but in real world usage this should have a substantial impact on how much memory is used to hold the text history.

ASP.NET MVC DataAnnotations and the RegularExpressionAttribute

A fellow Regex Hero user emailed me this morning about an inconsistency between what they were seeing in Regex Hero vs what they were seeing with the RegularExpression DataAnnotation in ASP.NET MVC . As a test, they were trying the following regular expression... ^A|B|C$ Against this string... ABC In Regex Hero you see 3 matches (as you should).  But in ASP.NET MVC it doesn't match, and validation fails. Why is this? As it turns out, the RegularExpressionAttribute is hiding an implementation detail.  In fact, I couldn't even find any mention of this on MSDN. It's most plainly visible if you open up the Javascript file that comes with an MVC project template, MicrosoftMvcValidation.js.  Inside you'll find this bit of code... var $0=new RegExp(this.$0); var $1=$0.exec(value); return (!Sys.Mvc._ValidationUtil.$0($ 1) &&  $1[0].length===value.length ); I've highlighted the important piece. It's checking to make sure the text value...

Improved TextBoxes With Better Whitespace Support

Today's update is all about whitespace. I've created a new textbox control for Regex Hero which is now being used for the 4 main textboxes: Regular Expression, Replacement String, Target String, and Final String. The new features are as follows: Figure 1: Matching Line Feeds Handles tab characters as it should. You can test this by entering \t in your regular expression and then hitting tab in your target string. Matching carriage returns or line feeds are now visible with a half-width character block (as seen in the figure 1). You may preserve the formatting of pasted text with the new "Preserve pasted formatting" option.  This will retain the existing line endings of your source text as was suggested about a month ago. Cycling through your matches with the up & down buttons is now much more responsive.

Now Supporting Facebook and Twitter Logins

This is something I've wanted to have for a long time but I simply haven't set aside the time to do it. Well, no more waiting, Regex Hero now supports logging in with Facebook and Twitter... If you already have an account with Regex Hero and want to sign in with something else (such as Facebook or Twitter) then you can add it to your account .  Or if you're a brand new user of Regex Hero, create your account here .

New Benchmarking Features and a New Homepage Design

Today I updated the benchmarking tool in Regex Hero with some new functionality. There were essentially two things I was looking to accomplish: Create insight into the benchmarking tool so that developers know exactly what it's doing. Add the ability to benchmark your regular expression with the IsMatch() function.  IsMatch() simply returns true if your regular expression has even 1 match in the specified string.  As such, it actually stops searching after the first match is found.  In some cases this makes it many times faster than iterating through every match. So now you'll see some new options to take care of all this... You can click the Show/Hide benchmarking code button at any point if you want to know exactly what Regex Hero is going to do under every benchmarking loop.  There are effectively 4 different benchmarking modes: 2 modes when the Match tab is selected, 1 mode for Replace, and 1 mode for Split. Homepage Redesign And of course I...