Using the Regex Class to Split Strings

The Regex class—defined in the System::Text::RegularExpressions namespace—encapsulates an immutable expression. By that, I mean that an instantiated Regex object can only represent the expression that was used to construct it. As a result, if you want to modify an expression once it's been used in the construction of a Regex object—or if you want to use multiple expressions—you'll need to construct a distinct Regex object for each desired modification or new expression. While at first blush this may seem like a limitation, as you work your way through the chapter, I'll bring this point into play at the appropriate times so that you see that the immutability of the Regex class is not a problem. I mention ...

Get Extending MFC Applications with the .NET Framework now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.