Regular expressions...

Well, something very simple. Yet as usual more complex than at first glance...

I am wondering if Windows 2000 and Windows XP have some COM-based control like MSXML for processing regular expressions. Yes, I know that there are plenty of Delphi components for handling regular expressions but I'm searching for something built-in by the operating system.

Why I'm not using some Delphi solution? Well, I actually have searched for several soltions and found plenty of options but someone suggested to me to also check if the Windows API has some standard function to use instead.

If no such API or COM library exists in Windows XP then too bad... Never hurts to ask anyways.
LVL 17
Wim ten BrinkSelf-employed developerAsked:
Who is Participating?
 
Russell LibbyConnect With a Mentor Software Engineer, Advisory Commented:

The closest thing you are going to get to "native" on a Win2K/XP box with IE6 is the vbscript.RegExp COM interface from vbscript.dll. Not that I can undestand why you would want to use it... as the COM overhead (not to mention its implementation) makes it much slower than a native code implementation of a regex parser.

Russell
0
 
mikelittlewoodCommented:
Can you give us an example of something?
0
 
Wim ten BrinkSelf-employed developerAuthor Commented:
Well, what I want to do is using regular expressions in my Delphi code. Well, not right away. I am to evaluate the build-in functionality of Windows on regular expressions so this is why I'm asking if Windows has some build-in support for regular expressions. And if it does, where? How?

I'm not interested in any third-part components for this. Plenty of options there. No, just the built-in functionality. It's purely for evaluation purposes to determine if I will have to use third-party components or if I can just use the Windows API for certain situations. I prefer to use built-in functionality if possible and am working on a code database to be used as reference for the company I work for. (And for me personally.) And I'm keeping any third-party solutions out of this code database.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
mikelittlewoodCommented:
Im still unsure what you want to do, probably my lack of knowledge of terminology.
I see you mentioned API, and I always thought that you could call any of the standard windows dll's for pretty much anything within delphi.

Think I better leave this one for another person.
0
 
Wim ten BrinkSelf-employed developerAuthor Commented:
:-)

Well, all I want to know if Windows has built-in functionality to use with regular expressions. So, basically assume you have a clean installation of Windows XP With Internet Explorer 6. Does this clean installation already have a library, a COM object or maybe just a Windows API to handle regular expressions? Or will I have to use third-party components for this?

With MSXML, for example, such a clean installation will have a DLL called MSXML.DLL in the System32 folder. This is a COM object which you can import in your project and it will provide lots of useful XML-related functions for you. I just wonder if there's something similar for regular expressions. (But it seems Microsoft itself isn't doing much with regular expressions...)
0
 
Eddie ShipmanAll-around developerCommented:
I agree with Russell. A regex DLL is MUCH faster than using any COM interfaced regex utility.
0
 
aikimarkCommented:
the JavaScriptingRuntime can do it.
0
 
Russell LibbySoftware Engineer, Advisory Commented:

True, but AFAIK the javascript/jscript regex is not exposed outside of the java environment...
0
 
aikimarkCommented:
it is registered as a COM object.  I've played with it in a VB application.
0
 
Russell LibbySoftware Engineer, Advisory Commented:
What's the programmatic ID / interface ID for this?
0
 
aikimarkCommented:
Russell,

While looking for this, I realized that your earlier VBScripting Regular Expression answer is the correct one.  I'm not sure what I was thinking of.  Please disregard my JavaScriptingRuntime suggestion.
0
 
Wim ten BrinkSelf-employed developerAuthor Commented:
Well, the only reason for using RegEx through COM would be because it can be done. That is, if a clean Windows XP installation (with IE6) already has some build-in support for it. There are of course many alternative solutions, some of them faster while others will be slower, but what I am working for is an overview of default Windows functionality.
And COM can be quite fast if you use early binding instead of late binding. :-) Unfortunately vbscript.dll doesn't make early binding very easy in my application. :-( But hey, it's one option. Are there more? :-)

If properly used, COM can be quite fast. Native code might be faster in some cases though but my experience with Delphi is that it's string-handling isn't really optimized for speed. Thus with things that have to process large strings (like XML files and regular expressions) I prefer to use alternative solutions that are either written in extremely optimized Delphi code (which is quite rare, actually) or written in a language like C++. Quality of the code matters too.

Btw, it doesn't have to be a COM-based solution. It just has to be a solution which is available on a clean Windows installation. :-) So a simple API call would be good enough too. Just as long as it doesn't depend on something third-party-like.
0
 
Wim ten BrinkSelf-employed developerAuthor Commented:
http://www.swissdelphicenter.ch/en/showcode.php?id=1478 is the most interesting one. :-) For some reason I don't get a proper type library in Delphi 6 for this DLL. But then I noticed that importing this type library in Delphi results in multiple entries being added and the ones below the one I was looking at was the TRegExp class. :-)

So I found it! With the help of Russell and aikimark.

The other links from aikimark are quite good but Russell was the one pointing out the solution. So doubling the points, splitting them and yet another question closed. :-)
0
 
aikimarkCommented:
Thanks for the points.

For your future planning and distribution, the .Net framework includes a regular expression class.
0
 
Wim ten BrinkSelf-employed developerAuthor Commented:
Yeah, I know. I also know about several of the alternative solutions that you've provided but I just wanted to know if a built-in option was available and if it was, how to use it. :-) You and Russell provided that information.

The additional links are useful for any other members here ate EE who are interested in regular expressions, which is why I increased the points. :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.