.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Generate all permutations/combinations of a Regex

Posted By:      Posted Date: September 22, 2010    Points: 0   Category :.NET Framework

I am writing a code which would produce a list of all possible combinations of a Regex.

For eg if my Regex is [ABC]BD i want all expressions possible for this combination like

to be validated

This is very simple example. My actual regex would include special charcaters,
character classes,repetitions, backreferences, positive & negativeloookaround and all other nitty-gritty of regex.

I know it would not be easy task as for characters like * the list is endless, but is there
a way to limit it to some extent?

I am looking for some code suggestions, api's  or any tool for this.
I do use expresso for regular expresssion.


any help will be greatly appreciated.

Abhinav Galodha

View Complete Post

More Related Resource Links

Test Run: Combinations and Permutations with F#


Understanding combinations and permutations is a fundamental skill in software testing. We show you how to work with combinations and permutations using code written in the new F# language.

James McCaffrey

MSDN Magazine May 2010

Almost Impossible Query -- Combinations and Permutations


I have a situation that is very difficult to solve.  Given the following tables:

Person -> Person_Shift <- Shift


create table person (id int not null, firstname varchar(32) not null, lastname varchar(32) not null, skill_level int not null)
create table shift (id int not null, shiftname varchar(32) not null, sortkey int not null)
create table person_shift(id int not null, personid int not null, shiftid int not null, shiftdate datetime not null)

The person table has 10,000+ names in it.  The shift table currently has 7 shifts (e.g., early morning, morning, early afternoon, afternoon, etc.).  The join table includes one record for each shift that a person is available for a given date.  The person table also includes a skill level, 1, 2 or 3.

A "meeting" is a shift on a given day.

The goal is to find the same persons who are available to attend the same set of meetings.  The meetings can be spread across several days and shifts, so long as all the people are the same at each meeting.

The inputs are:

# of people (these people must be available for all meetings)
# of meetings
Minimum # of skill level 1 people
Minimum # of skill level 2 people
Minimum # of skill level 3 people

A typical example would be:

8 people
10 meetings<

Generate thumbnails on the fly

There are many posts how to generate thumbnails using ASP.NET. Some good some less. Be sure to get distance from the versions that use Image.GetThumbnailImage method.

Generate Random Numbers

SQL Server has a built-in function that generates a random number, the RAND() mathematical function. The RAND math function returns a random float value from 0 through 1.

Generate rss feed with HTTPHandler





I'm looking for link/tutorials/code samples on How to create HttpHandler for generating rss feeds for a website.




ASP.NET Designer - How Do I generate this Design-Time Markup?


I want to generate this:
    <x:MyControl id="a" runat="server">
            <x:MyScript .. />

Regex pattern for validating IPv6


Can anyone can make a regular expression pattern for validating IPv6 (not IPv4)?

Ipv6 has many formats and aliases. I tried making the pattern but written in a lot of codes (i'm not sure my code below will be 100% accepting valid formats and 100% declines invalid formats).


How to generate large pdf's?


Hi all,

I am using rdlc reports in my appln. Am trying to generate a huge pdf file which almost consists of 1500 - 2000 pages.
I have used ReportViewer and am adding datasource (Generic collection) to report. But am getting system out of Memory exception as it is a huge file.
Can any one suggest me how to generate large pdf files in asp.net c#

Test Run: String Permutations


The ability to programmatically create and use string permutations is essential in software testing, as James McCaffrey explains.

Dr. James McCaffrey

MSDN Magazine December 2006

Toolbox: Generate Office Documents, Monitor Event Logs, and More


Most data-driven Web sites are used as interfaces to collect, process, and summarize information. Reports that summarize the data can be presented to the user in a variety of formats-the most common way is to display the report directly in a Web page.

Scott Mitchell

MSDN Magazine June 2006

UI on the Fly: Use the .NET Framework to Generate and Execute Custom Controls at Run Time


Creating UI controls on the fly can be accomplished via run-time code generation. And there are lots of reasons to do so. Generating these controls once and then reusing them as needed is more efficient than generating the controls each time. Read on.

Morgan Skinner

MSDN Magazine December 2005

Stay Alert: Use Managed Code To Generate A Secure Audit Trail


In today's security-conscious environments, a reliable audit trail is a valuable forensic tool The Windows Server 2003 operating system provides features that let you enable a wide range of applications to make use of auditing functionality. This article looks at auditing from the operating system perspective and describes a sample managed code implementation that will allow you to add auditing to your own server applications.

Mark Novak

MSDN Magazine October 2005

DCOM Interop: Generate Custom Managed C++ Wrappers for Easier COM Interoperation Using DCOMSuds


Now that you're writing managed code, you'll certainly want to use your existing COM components, but you can't simply call them directly. Instead, you have to wrap the COM component in a runtime-callable wrapper that acts as a proxy between the component and your managed code. While the CLR provides wrapper classes for this purpose, there will be times when you'll want custom objects to wrap your COM components. One way to get the low-level access you need to precisely control resource cleanup, pass security information, and get access to CLR features is to write your own wrapper class in managed C++. This article shows you how.

Vishwas Lele

MSDN Magazine August 2003

B2B Frontiers in E-Commerce: Implement Affiliate Programs to Create New Partnerships and Generate Bu


Like the Internet itself, e-commerce is evolving. Today's e-commerce companies are allowing their customers to plug into existing catalogs and ordering systems, creating new synergistic relationships. Some companies are even adding real-time chat with customer service personnel. This article gives you an overview of some of the new e-commerce concepts and implementations that are helping forge those new relationships with customers, vendors, and shipping companies. The importance of these relationships, as well as the specific technologies used to encourage communication and collaboration are discussed and illustrated with representative code samples.

Ted Coombs

MSDN Magazine May 2000

generate create script of table using c# and SQL server 7.0, can anyone help me?


I want to generate create table script using c#.net, I want to connect sql server 7.0 and generate table create script. Its urgent kindly help me urgently.

Custom tool error: Failed to generate code for the service reference 'CompanyService'. Please che


A little background because I feel I have an out of the ordinary architecture in place and don't know if this is contributing to the problem. 

We have an existing ASP.net application that is undergoing expansion.  The new functionality is all written in Silverlight 4.  As part of that expansion I gutted all the old Linq to SQL and put Entity Framework 4 into place.  To do this I created a standard .net Class Library and added my edmx files there.  Naturally, the business entities created by this cannot be used in Silverlight.  So I created a Silverlight Class Library and added all the business entities to that Silverlight Class Library as linked files.  I changed the name space to be the same.

So I have the following assembly / namespaces

Company.Project.Dal.csproj / Company.Project.Entities (.net 4 class library)

Company.Project.Entities.csproj / Company.Project.Entities (SL4 class library)

With this architecture I was able to share my business entities with my SL enabled web services, my asp.net projects, my silverlight projects.  Really it's a beautiful thing.

Once this was done I added "message" classes to Company.Project.Dal and again shared them with the other entites using linked files.  These messages are things like MyObjectRequest; they are class

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend