次の方法で共有


RegexCompilationInfo コンストラクタ

アセンブリを作成するためにコンパイラが必要とする情報を格納している RegexCompilationInfo オブジェクトを作成します。

Public Sub New( _
   ByVal pattern As String, _   ByVal options As RegexOptions, _   ByVal name As String, _   ByVal fullnamespace As String, _   ByVal ispublic As Boolean _)
[C#]
public RegexCompilationInfo(
   stringpattern,RegexOptionsoptions,stringname,stringfullnamespace,boolispublic);
[C++]
public: RegexCompilationInfo(
   String* pattern,RegexOptionsoptions,String* name,String* fullnamespace,boolispublic);
[JScript]
public function RegexCompilationInfo(
   pattern : String,options : RegexOptions,name : String,fullnamespace : String,ispublic : Boolean);

パラメータ

  • pattern
    コンパイルする正規表現。
  • options
    正規表現をコンパイルするときに使用するコンパイラ オプション。
  • name
    コンパイルされた正規表現に使用する型の名前。
  • fullnamespace
    新しい型の追加先の名前空間。
  • ispublic
    コンパイルされた正規表現をパブリックに参照できるようにする場合は true 。それ以外の場合は false

使用例

 
' Create the pattern.
Dim pat As String = "(\w+)\s+(car)"
' Create the compilation information.
Dim rci As New RegexCompilationInfo(pat,RegexOptions.IgnoreCase,"CarRegex","MyApp",true)
' Set up to compile.
Dim an As New AssemblyName()
an.Name = "CarRegex_Vb"
Dim rcilist() As RegexCompilationInfo = { rci }
' Compile the regular expression.
Regex.CompileToAssembly(rcilist, an)

[C#] 
// Create the pattern.
string pat = @"(\w+)\s+(car)";
// Create the compilation information.
RegexCompilationInfo rci = new RegexCompilationInfo(
   pat, RegexOptions.IgnoreCase, "CarRegex", "MyApp", true);
// Setup to compile.
AssemblyName an = new AssemblyName();
an.Name = "CarRegex_Cs";
RegexCompilationInfo[] rcilist = { rci };
// Compile the regular expression.
Regex.CompileToAssembly(rcilist, an);

[C++] 
// Create the pattern.
String* pat = S"(\\w+)\\s+(car)";
// Create the compililation information.
RegexCompilationInfo* rci = new RegexCompilationInfo(
   pat, RegexOptions::IgnoreCase, S"CarRegex", S"Car", true);
// Set up to compile.
AssemblyName* an = new AssemblyName();
an->Name = S"carregex";
RegexCompilationInfo* rcilist[] = { rci };
// Compile the regular expression.
Regex::CompileToAssembly(rcilist, an);

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

RegexCompilationInfo クラス | RegexCompilationInfo メンバ | System.Text.RegularExpressions 名前空間