Re: Regex.Replace...
Per Bolmstedt <[email protected]> Fri, 12 Oct 2007 12:40:09 +0200
| Newsgroups | gmane.comp.windows.devel.dotnet.cx |
|---|---|
| Message-ID | <[email protected]> |
Gary Harpin wrote: > I am trying to use Regex.Replace() to clean a string before working on > it. For the record, regular expressions in .NET don't have any relation to "the specifics of the C# and Managed C++ languages" (from this list's name). They're part of the BCL. Furthermore, "Microsoft .NET Framework regular expressions incorporate the most popular features of other regular expression implementations such as those in Perl and awk" and specifically are "Designed to be compatible with Perl 5 regular expressions", which means most regular expression documentation applies. But all the same, ".NET Framework regular expressions include features not yet seen in other implementations, such as right-to-left matching and on-the-fly compilation" (from the Developer's Guide). All the same, I've found that using a Regular Expression IDE that lets you instantly evaluate expressions, and in a sense "debug" them, is usually much faster for learning than reading the documentation. I've used Expresso[1] on occasion, but I don't know if there's something better out there. In my experience, you rarely need to mix String.Replace() and RegEx.Replace(); one well-crafted regular expression usually does the job, and it can make your code more coherent. 1: http://www.ultrapico.com/Expresso.htm =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com