troubleshooting Question

Compare regular expressions!

Avatar of LenWinSonSoft
LenWinSonSoft asked on
25 Comments1 Solution509 ViewsLast Modified:

i have a big problem... In fact there is no way around...

Imagine you have two regular expressions "ab?yz" and maybe "?cd?". The "?" means any string. It doesnt matter which kind of regular expression i have to use!
But now the problem. How can I check weather this two expression can describe the same string, for example "abcdyz" would match both.
Dont hang on this two expressions... I need an algorithm for all thinkable expressions. Its enough to have the "?" for any string without backslashes and the "*" for any string, but also the backslashs.

So "?:\dir\*\test.txt" can be "C:\dir\private\test.txt" or "C:\dir\private\subdir\test.txt"...
"?:\dir\?\test.txt" can only be "C:\dir\private\test.txt" but not "C:\dir\private\subdir\test.txt"...

The expressions "?:\dir\*\test.txt" can be matched by the same string as "?:\dir\?\test.txt".
But "?:\dir\*\test.txt" cannot be matched by "?:\dir\*\test.exe" for example!

How can i realize this??? The next problem is, that this algorithm should process at least 10000 comparsions per secound! But thats not so important.

I am using Visual Studio 2003 and C++...

Thanks for advance!
Mfg Martin
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 25 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 25 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros