RegexCompilationInfo Constructor
Initializes a new instance of the RegexCompilationInfo class that contains information about a regular expression to be included in an assembly.
Assembly: System (in System.dll)
public: RegexCompilationInfo( String^ pattern, RegexOptions options, String^ name, String^ fullnamespace, bool ispublic )
Parameters
- pattern
- Type: System::String
The regular expression to compile.
- options
- Type: System.Text.RegularExpressions::RegexOptions
The regular expression options to use when compiling the regular expression.
- name
- Type: System::String
The name of the type that represents the compiled regular expression.
- fullnamespace
- Type: System::String
The namespace to which the new type belongs.
- ispublic
- Type: System::Boolean
true to make the compiled regular expression publicly visible; otherwise, false.
Each parameter of the RegexCompilationInfo constructor directly corresponds to a property of the RegexCompilationInfo class. Because all properties are read/write, their values can also be assigned directly.
The CompileToAssembly method generates an assembly that contains compiled regular expressions. Therefore, you do not have to specify Compiled as one of the values of options.
If ispublic is true, the compiled regular expression class is given public accessibility. That is, it can be instantiated from code that executes in any assembly. If ispublic is false, the compiled regular expression class is given internal (in C#) or Friend (in Visual Basic) accessibility. That is, it can be instantiated only from code that executes in the same assembly as the regular expression class.
The following example creates and uses a compiled regular expression in two steps.
In the first step, compile and execute the following code example. The RegexCompilationInfo constructor in the code example defines a compiled regular expression. The result of executing the code is an assembly named FishRegex.dll that contains a compiled regular expression type named FishRegex.
In the second step, compile the following code example using a reference to FishRegex.dll, and then run the resulting executable file. The executable file matches a target string by using the FishRegex type, and displays the match, group, capture group, and index position of the matches in the target string.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.