Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Visual Studio Add-in for testing regular expressions

, 1 Dec 2010 CPOL
An add-in for debugging and creating regular expression directly in Visual Studio
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Globalization;

namespace RegexTester.Parsing
    public interface IRegexFormatProvider
        Regex GetSyntaxRegex();
        IRegexFindResults GetRegexFindResults(Match match);

    public abstract class BaseRegexFormatProvider : IRegexFormatProvider
        public Regex GetSyntaxRegex()
            if (SyntaxRegex == null)
                string regexMatch = string.Format(CultureInfo.InvariantCulture,
                    GetStringMatchRegex("regex"), GetStringMatchRegex("replace"),
                    GetOptionsMatchRegex("options", "regexnamespace", "option"), GetStringMatchRegex("onlyregex"),
                SyntaxRegex = new Regex(regexMatch, RegexOptions.IgnoreCase | RegexOptions.Compiled);
            return SyntaxRegex;

        protected abstract Regex SyntaxRegex { get; set; }
        public abstract IRegexFindResults GetRegexFindResults(Match match);
        protected abstract string GetStringMatchRegex(string matchName);
        protected abstract string GetOptionsMatchRegex(string optionsName, string namespaceName, string optionName);

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Andreas Andersen
Software Developer (Senior)
Denmark Denmark
.NET developer. I wanted to be first an astronaut, then a jet pilot, but when I got a Commodore 64 for Christmas I never looked back. Also I would never have qualified for the first two things and everybody knows computer programmers get all the girls.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.141220.1 | Last Updated 1 Dec 2010
Article Copyright 2010 by Andreas Andersen
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid