の複合式が必要です
" from" such that " from" is not within parenthesis
(括弧内は無視)こちらa=" from"; b="("; and c=")";
私が書くことができる最も近い(しかし無効な)パターンは
string pat = @"^((?!\(.* from.*\)).)* from((?!\(.* from.*\)).)*$";
私の式は、「from」が括弧内に存在するかどうかを否定しますが、そのような「from」は厳密に無視したい
一致は次の場所にあります。
1: " from" 2:select field1 from t1 (select field1 from t1) ---- 1 time in both
3: select field1 from t1 (select field1 from t1)select field1 from t1 ---2 times
一致を含まない文字列:(括弧内の「から」を無視したいため)
1: select field1 no_f_rom_OutOf_Parenthesis t1 (select field1 from t1)
2: (select field1 from t1) 3: "" (Empty String) 4. No word as form
0 times in all four strings
関連資料: (あまり読む必要はありません)
「パターン」に一致するが「通常」には一致しない方法を説明する私の質問に最も近いリンクは、次のリンクの 2009 年 7 月 31 日午前 8 時 5 分に stanav からの返信です...
http://www.vbforums.com/archive/index.php/t-578417.html
また、「this」を含むが「that」を含まない C# の正規表現
私は約1週間勉強/検索しましたが、それでも私にとっては複雑です:)