DataBindRegexとは? わかりやすく解説

DataBindRegex クラス

ASP.NET データ バインディング解析するための正規表現提供します

名前空間: System.Web.RegularExpressions
アセンブリ: System.Web.RegularExpressions (system.web.regularexpressions.dll 内)
構文構文

Public Class DataBindRegex
    Inherits Regex
    Implements ISerializable
Dim instance As DataBindRegex
public class DataBindRegex : Regex, ISerializable
public ref class DataBindRegex : public
 Regex, ISerializable
public class DataBindRegex extends Regex implements
 ISerializable
public class DataBindRegex extends
 Regex implements ISerializable
解説解説

DataBindRegex クラスは、ASP.NET データ バインディング (<%#%>) を解析するための正規表現提供します

メモメモ

System.Web.RegularExpressions クラスは、.NET FrameworkASP.NET ページ解析する際に使用するものであり、一般的なアプリケーションでは必ずしも実用性があるとは言えません。たとえば、これらのクラス多くは、文字列先頭にのみ一致します

使用例使用例

DataBindRegex クラスコード例次に示します

' This example demonstrates the System.Web.RegularExpressions 
' constructors. 
' Each regular expression class is used to match an appropriate 
' string. Note that the System.Web.RegularExpressions classes 
' are intended for internal use and are not always practical for 
' general applications. In particular, many of these regular 
' expressions match only the beginning of a string.

Imports System
Imports System.Text.RegularExpressions
Imports System.Web.RegularExpressions

Class Sample
    Public Shared Sub Main()
 
        Dim str1A As String
 = "<%-- COMMENT BLOCK --%> Initial pattern."
        Dim str1B As String
 = "Embedded pattern. <%-- COMMENT BLOCK --%>"
        Dim str02 As String
 = "<% CODE BLOCK %>"
        Dim str03 As String
 = "<%= EXPRESSION BLOCK %>"
        Dim str04 As String
 = "<%# DATA BINDING EXPRESSION %>"
        Dim str05 As String
 = "<%@ DIRECTIVE %>"
        Dim str06 As String
 = "</END_TAG> xyz"
        Dim str07 As String
 = "GREATER THAN >"
        Dim str08 As String
 = "< LESS THAN"
        ' Include directive.
        Dim str09 As String
 = "<!-- #include file=""filename.ext""
 -->"
        ' runat="server" attribute.
        Dim str10 As String
 = "<script runat=""server""
 language=""codelanguage"" src=""pathname"">"
        Dim str11 As String
 = "<% SERVER TAG %>"
        Dim str12 As String
 = "abc defg hi jkl <%-- TEXTREGEX --%> mno pqr"
        Dim str13 As String
 = "<%# DATA BINDING %>"
        Dim str14 As String
 = "<asp:TAG> ... </asp:TAG>"
        Dim str15 As String
 = "<%@ SIMPLE DIRECTIVE %>"
        
        ' -------------------------------------------------------------------
        ' Demonstrate that a pattern must occur at the beginning of
 the 
        ' string. That is, the entire string is not scanned for the
 pattern.
        ' -------------------------------------------------------------------
        Dim cr As New CommentRegex()
        Display(cr, str1A)
        Display(cr, str1B)
        ' -------------------------------------------------------------------
        Display(New AspCodeRegex(), str02)
        Display(New AspExprRegex(), str03)
        Display(New DatabindExprRegex(), str04)
        Display(New DirectiveRegex(), str05)
        Display(New EndTagRegex(), str06)
        Display(New GTRegex(), str07)
        Display(New LTRegex(), str08)
        Display(New IncludeRegex(), str09)
        Display(New RunatServerRegex(), str10)
        Display(New ServerTagsRegex(), str11)
        Display(New TextRegex(), str12)
        Display(New DataBindRegex(), str13)
        Display(New TagRegex(), str14)
        Display(New SimpleDirectiveRegex(), str15)
    End Sub 'Main
    
    Protected Shared Sub
 Display(ByVal r As Regex, ByVal
 s As String) 
        Console.WriteLine("Input: ""{0}""",
 s)
        Dim m As Match = r.Match(s)
        If m.Success Then
            Console.WriteLine("Match: ""{0}""",
 m.Value)
        Else
            Console.WriteLine("There is no match.")
        End If
        Console.WriteLine()
    End Sub 'Display
End Class 'Sample
'
'This code example produces the following results:
'
'Input: "<%-- COMMENT BLOCK --%> Initial pattern."
'Match: "<%-- COMMENT BLOCK --%>"
'
'Input: "Embedded pattern. <%-- COMMENT BLOCK --%>"
'There is no match.
'
'Input: "<% CODE BLOCK %>"
'Match: "<% CODE BLOCK %>"
'
'Input: "<%= EXPRESSION BLOCK %>"
'Match: "<%= EXPRESSION BLOCK %>"
'
'Input: "<%# DATA BINDING EXPRESSION %>"
'Match: "<%# DATA BINDING EXPRESSION %>"
'
'Input: "<%@ DIRECTIVE %>"
'Match: "<%@ DIRECTIVE %>"
'
'Input: "</END_TAG> xyz"
'Match: "</END_TAG>"
'
'Input: "GREATER THAN >"
'Match: " >"
'
'Input: "< LESS THAN"
'Match: "< "
'
'Input: "<!-- #include file="filename.ext" -->"
'Match: "<!-- #include file="filename.ext" -->"
'
'Input: "<script runat="server" language="codelanguage"
 src="pathname">"
'Match: "runat="server"
'
'Input: "<% SERVER TAG %>"
'Match: "<% SERVER TAG %>"
'
'Input: "abc defg hi jkl <%-- TEXTREGEX --%> mno pqr"
'Match: "abc defg hi jkl "
'
'Input: "<%# DATA BINDING %>"
'Match: "<%# DATA BINDING %>"
'
'Input: "<asp:TAG> ... </asp:TAG>"
'Match: "<asp:TAG>"
'
'Input: "<%@ SIMPLE DIRECTIVE %>"
'Match: "<%@ SIMPLE DIRECTIVE %>"
'
// This example demonstrates the System.Web.RegularExpressions 
// constructors. 
// Each regular expression class is used to match an appropriate 
// string. Note that the System.Web.RegularExpressions classes 
// are intended for internal use and are not always practical for 
// general applications. In particular, many of these regular 
// expressions match only the beginning of a string.

using System;
using System.Text.RegularExpressions;
using System.Web.RegularExpressions;

class Sample 
{
    public static void Main()
 
    {
    string str1A = "<%-- COMMENT BLOCK --%> Initial
 pattern.";
    string str1B = "Embedded pattern. <%-- COMMENT BLOCK
 --%>";
    string str02 = "<% CODE BLOCK %>";
    string str03 = "<%= EXPRESSION BLOCK %>";
    string str04 = "<%# DATA BINDING EXPRESSION %>";
    string str05 = "<%@ DIRECTIVE %>";
    string str06 = "</END_TAG> xyz";
    string str07 = "GREATER THAN >";
    string str08 = "< LESS THAN";
                                     // Include directive.
    string str09 = @"<!-- #include file=""filename.ext""
 -->"; 
                                     // runat="server" attribute.
    string str10 = @"<script runat=""server""
 " + 
                   @"language=""codelanguage"" src=""pathname"">";
    string str11 = "<% SERVER TAG %>";
    string str12 = "abc defg hi jkl <%-- TEXTREGEX --%>
 mno pqr";
    string str13 = "<%# DATA BINDING %>";
    string str14 = "<asp:TAG> ... </asp:TAG>";
    string str15 = "<%@ SIMPLE DIRECTIVE %>";

// -------------------------------------------------------------------
// Demonstrate that a pattern must occur at the beginning of the 
// string. That is, the entire string is not scanned for the pattern.
// -------------------------------------------------------------------
    CommentRegex cr = new CommentRegex();
    Display(cr, str1A);
    Display(cr, str1B);
// -------------------------------------------------------------------

    Display(new AspCodeRegex(),         str02);
    Display(new AspExprRegex(),         str03);
    Display(new DatabindExprRegex(),    str04);
    Display(new DirectiveRegex(),       str05);
    Display(new EndTagRegex(),          str06);
    Display(new GTRegex(),              str07);
    Display(new LTRegex(),              str08);
    Display(new IncludeRegex(),         str09);
    Display(new RunatServerRegex(),     str10);
    Display(new ServerTagsRegex(),      str11);
    Display(new TextRegex(),            str12);
    Display(new DataBindRegex(),        str13);
    Display(new TagRegex(),             str14);
    Display(new SimpleDirectiveRegex(), str15);
    }

    protected static void
 Display(Regex r, string s) 
    {
    Console.WriteLine("Input: \"{0}\"", s);
    Match m = r.Match(s);
    if (m.Success)
        Console.WriteLine("Match: \"{0}\"", m.Value);
    else
        Console.WriteLine("There is no match.");
    Console.WriteLine();
    }
}
/*
This code example produces the following results:

Input: "<%-- COMMENT BLOCK --%> Initial pattern."
Match: "<%-- COMMENT BLOCK --%>"

Input: "Embedded pattern. <%-- COMMENT BLOCK --%>"
There is no match.

Input: "<% CODE BLOCK %>"
Match: "<% CODE BLOCK %>"

Input: "<%= EXPRESSION BLOCK %>"
Match: "<%= EXPRESSION BLOCK %>"

Input: "<%# DATA BINDING EXPRESSION %>"
Match: "<%# DATA BINDING EXPRESSION %>"

Input: "<%@ DIRECTIVE %>"
Match: "<%@ DIRECTIVE %>"

Input: "</END_TAG> xyz"
Match: "</END_TAG>"

Input: "GREATER THAN >"
Match: " >"

Input: "< LESS THAN"
Match: "< "

Input: "<!-- #include file="filename.ext" -->"
Match: "<!-- #include file="filename.ext" -->"

Input: "<script runat="server" language="codelanguage"
 src="pathname">"
Match: "runat="server"

Input: "<% SERVER TAG %>"
Match: "<% SERVER TAG %>"

Input: "abc defg hi jkl <%-- TEXTREGEX --%> mno pqr"
Match: "abc defg hi jkl "

Input: "<%# DATA BINDING %>"
Match: "<%# DATA BINDING %>"

Input: "<asp:TAG> ... </asp:TAG>"
Match: "<asp:TAG>"

Input: "<%@ SIMPLE DIRECTIVE %>"
Match: "<%@ SIMPLE DIRECTIVE %>"
*/
継承階層継承階層
System.Object
   System.Text.RegularExpressions.Regex
    System.Web.RegularExpressions.DataBindRegex
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataBindRegex メンバ
System.Web.RegularExpressions 名前空間
Regex クラス

DataBindRegex コンストラクタ


DataBindRegex フィールド


DataBindRegex プロパティ


DataBindRegex メソッド


パブリック メソッドパブリック メソッド

( プロテクト メソッド参照)
  名前 説明
パブリック メソッド CompileToAssembly  オーバーロードされます正規表現コンパイルして、ディスク上の単一アセンブリ保存します。 ( Regex から継承されます。)
パブリック メソッド Equals  オーバーロードされます2 つObject インスタンス等しかどうか判断します。 ( Object から継承されます。)
パブリック メソッド Escape  メタ文字 (\、*、+、?、|、{、[、(、)、^、$、.、#、および空白) をエスケープ コード置き換えることにより、それらのメタ文字エスケープします。 ( Regex から継承されます。)
パブリック メソッド GetGroupNames  正規表現使用されるキャプチャ グループ名の配列返します。 ( Regex から継承されます。)
パブリック メソッド GetGroupNumbers  配列内のグループ名に対応したキャプチャ グループ番号配列返します。 ( Regex から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用適してます。 ( Object から継承されます。)
パブリック メソッド GetType  現在のインスタンスType取得します。 ( Object から継承されます。)
パブリック メソッド GroupNameFromNumber  指定したグループ番号対応するグループ名を取得します。 ( Regex から継承されます。)
パブリック メソッド GroupNumberFromName  指定したグループ名に対応するグループ番号返します。 ( Regex から継承されます。)
パブリック メソッド IsMatch  オーバーロードされます正規表現一致する対象入力文字列内で見つかったかどうか示します。 ( Regex から継承されます。)
パブリック メソッド Match  オーバーロードされます入力文字内で正規表現一致する対象1 つ検索し、その正確な結果単一Match オブジェクトとして返します。 ( Regex から継承されます。)
パブリック メソッド Matches  オーバーロードされます入力文字列内で正規表現一致する対象をすべて検索しMatch繰り返し呼び出され場合同じように、連続して見つかった対象をすべて返します。 ( Regex から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 ( Object から継承されます。)
パブリック メソッド Replace  オーバーロードされます正規表現によって定義されている文字パターン一致するすべての対象指定置換文字列に置き換えます。 ( Regex から継承されます。)
パブリック メソッド Split  オーバーロードされます正規表現によって定義されている位置で、入力文字列部分文字列配列分割します。 ( Regex から継承されます。)
パブリック メソッド ToString  Regex コンストラクタ渡され正規表現パターン返します。 ( Regex から継承されます。)
パブリック メソッド Unescape  入力文字列内にエスケープされた文字がある場合は、そのエスケープ解除します。 ( Regex から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

DataBindRegex クラス
System.Web.RegularExpressions 名前空間
Regex クラス

DataBindRegex メンバ

ASP.NET データ バインディング解析するための正規表現提供します

DataBindRegex データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド DataBindRegex DataBindRegex クラス新しインスタンス初期化します。
プロテクト フィールドプロテクト フィールド
パブリック プロパティパブリック プロパティ
パブリック メソッドパブリック メソッド
( プロテクト メソッド参照)
  名前 説明
パブリック メソッド CompileToAssembly  オーバーロードされます正規表現コンパイルして、ディスク上の単一アセンブリ保存します。 (Regex から継承されます。)
パブリック メソッド Equals  オーバーロードされます2 つObject インスタンス等しかどうか判断します。 (Object から継承されます。)
パブリック メソッド Escape  メタ文字 (\、*、+、?、|、{、[、(、)、^、$、.、#、および空白) をエスケープ コード置き換えることにより、それらのメタ文字エスケープします。 (Regex から継承されます。)
パブリック メソッド GetGroupNames  正規表現使用されるキャプチャ グループ名の配列返します。 (Regex から継承されます。)
パブリック メソッド GetGroupNumbers  配列内のグループ名に対応したキャプチャ グループ番号配列返します。 (Regex から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用適してます。 (Object から継承されます。)
パブリック メソッド GetType  現在のインスタンスType取得します。 (Object から継承されます。)
パブリック メソッド GroupNameFromNumber  指定したグループ番号対応するグループ名を取得します。 (Regex から継承されます。)
パブリック メソッド GroupNumberFromName  指定したグループ名に対応するグループ番号返します。 (Regex から継承されます。)
パブリック メソッド IsMatch  オーバーロードされます正規表現一致する対象入力文字列内で見つかったかどうか示します。 (Regex から継承されます。)
パブリック メソッド Match  オーバーロードされます入力文字内で正規表現一致する対象1 つ検索し、その正確な結果単一Match オブジェクトとして返します。 (Regex から継承されます。)
パブリック メソッド Matches  オーバーロードされます入力文字列内で正規表現一致する対象をすべて検索しMatch繰り返し呼び出され場合同じように、連続して見つかった対象をすべて返します。 (Regex から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 (Object から継承されます。)
パブリック メソッド Replace  オーバーロードされます正規表現によって定義されている文字パターン一致するすべての対象指定置換文字列に置き換えます。 (Regex から継承されます。)
パブリック メソッド Split  オーバーロードされます正規表現によって定義されている位置で、入力文字列部分文字列配列分割します。 (Regex から継承されます。)
パブリック メソッド ToString  Regex コンストラクタ渡され正規表現パターン返します。 (Regex から継承されます。)
パブリック メソッド Unescape  入力文字列内にエスケープされた文字がある場合は、そのエスケープ解除します。 (Regex から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

DataBindRegex クラス
System.Web.RegularExpressions 名前空間
Regex クラス



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「DataBindRegex」の関連用語

DataBindRegexのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DataBindRegexのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS