precompiled regular expressions

P

Poolbeer

Bill,

You should take a look at the RegEx.CompileToAssembly shared method.

This article mentions it once but worth reading.
http://www.ftponline.com/vsm/2003_01/magazine/features/balena/default_pf.aspx

<QUOTE>
....
In this case, the regular expression is converted to Microsoft Intermediate Language (MSIL), which is compiled eventually to super-fast native code the first time you call the IsMatch, Match, Matches, or Replace methods. The only downsides to this technique are that the first call to the method takes slightly longer and that the native code hangs around in memory until the application shuts down. For these reasons, you should use the Compiled option only if you expect to reuse the same Regex object often during the application's lifetime. The Regex class even exposes the CompileToAssembly shared method, which lets you compile one or more regular expressions into a DLL, so that you can reuse those precompiled regular expressions later without any overhead at run time.
....
</QUOTE>

Hope this help you on your way.

Greets,

Poolbeer (MCP)

---

I saw this in an article in Microsoft's site, "An alternative is to use precompiled regular expressions. You can compile all of your expressions into a reusable DLL. This avoids the need to compile at runtime while still benefiting from the speed of compiled regular expressions."

I can't find where it tells you how to do this. Can anyone help.

Article:
http://msdn.microsoft.com/library/d.../en-us/cpguide/html/cpconcompilationreuse.asp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top