Francesco's blog

 Tuesday, August 29, 2006

I know, I know, there are soooo many regular expression tester tools available on the 'Net, but I couldn't help creating my own. It's very simple, yet it supports all the basic features you'd espect from a tool of its kind, including code generation (VB and C#) and compilation to stand-alone assemblies. Best of all, it comes with source code. You can download it from the home page of my Visual Basic 2005 book (together with all other code samples in the book) or directly from here:

Executable (requires .NET Framework 2.0): RegexTester.zip (75.57 KB)
Source code (VB2005): RegexTester source.zip (88.15 KB)

Using the tool is quite simple. The main window is divided in three panes: (a) the pane where you enter the regex, (b) the pane where you load the text the regex must be applied to, (c) the result pane. A fourth pane appears when you select the Replace item from the Commands menu, and it's where you enter the replace pattern. As you can see in the image below, you can enter most regex patterns by selecting them from the context menu:

You select the kind of command (Find, replace, Split) from the Commands menu and you select one or more regex options from the Options menu:

After selecting the proper options, you press the F5 key (the Run item in the Commands menu) to execute the regex. Results are displayed in the bottom pane in a variety of formats and sort orders, which you can select from the Results menu, and the status bar displays the number of matches, the execution time, and the properties of the result currently highlighted in the result pane:

Alternatively, you can set all these options from the Properties dialog box (the Properties command in the File menu, or just press the F4 key):

Assigning a name to the current regex is important because you can save it on disk in a file with .regex extension, for later retrieval.

The Commands menu contains a couple of other interesting items. First, you can generate the C# or VB code for the current regular expression and copy it to the Clipboard:

Second, and more interesting, you can compile one or more regular expressions (including saved .regex projects) into a compiled assembly, which you can later reference from any .NET application. Using such compiled regexes is obviously faster than defining them in code, because you skip the parsing step:

 

That's it. You can use the YART tool for your own use, study its source code, modify and expands it as you like. If you find any major problems or add some noteworthy feature, just let me know.

C# | Regex | Tools | Visual Basic
2/20/2008 11:26:35 AM (GMT Standard Time, UTC+00:00)
Hi Francesco,

Just found this tool. Seriously helpful!

Thanks,

Waseem
10/1/2008 4:50:57 PM (GMT Daylight Time, UTC+01:00)
Indeed a very useful tool, especially now I'm creating a plugin that screen scrapes information from websites :)
5/14/2009 5:30:52 PM (GMT Daylight Time, UTC+01:00)
Hi guys. Here's to the crazy ones, the misfits, the rebels, the troublemakers, the round pegs in the square holes... the ones who see things differently -- they're not fond of rules... You can quote them, disagree with them, glorify or vilify them, but the only thing you can't do is ignore them because they change things... they push the human race forward, and while some may see them as the crazy ones, we see genius, because the ones who are crazy enough to think that they can change the world, are the ones who do.
I am from Northern and too poorly know English, tell me right I wrote the following sentence: "Busby seo test by indonesian seo newbie need all indonesia seo master support to win busby seo contest.We provide both seo and sem services to achieve top rankings on the web."

Thank :-( Drew.
6/20/2009 10:30:51 PM (GMT Daylight Time, UTC+01:00)
I like it and I think you make a good point. Thanks for taking the time to share this with us
7/10/2009 1:28:28 AM (GMT Daylight Time, UTC+01:00)
Just found this tool. Seriously helpful!
9/21/2009 7:50:42 AM (GMT Daylight Time, UTC+01:00)
Good tool. i still feel regex is the hardest one when it comes for testing.
9/21/2009 7:53:49 AM (GMT Daylight Time, UTC+01:00)
Regular Exprssions are powerful if we know how to prepare the pattern. I am pretty sure that this tool will be helpful on this.

thanks
11/9/2009 12:22:19 PM (GMT Standard Time, UTC+00:00)
Thanks a lot! This tool is sure to be helpful!
11/17/2009 8:20:27 AM (GMT Standard Time, UTC+00:00)
this tool is really useful. Your other posts are also like.
2/2/2010 5:27:11 AM (GMT Standard Time, UTC+00:00)
[url=http://www.discountukghd.com/]ghd[/url] [url=http://www.discountukghd.com/]ghd hair straighteners[/url] always attract people's attention, since people are fond of [url=http://www.discountukghd.com/]ghd hair straightener[/url] especially [url=http://www.discountukghd.com/pink-ghd-c-3.html]pink ghd straighteners[/url] .
Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):

 
Get RSS/Atom Feed
RSS 2.0 | Atom 1.0
Search in the blog
Archive
<March 2010>
SunMonTueWedThuFriSat
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910
Categories

Powered by: newtelligence dasBlog 1.8.5223.1