Find a pattern to match 'a', ignoring that 'a' which lies within 'b' and 'c'

后端 未结 2 1314
你的背包
你的背包 2021-01-25 16:15

Need a compound expression for

\" from\" such that \" from\" is not within parenthesis

(ignoring those which are in parenthesi

2条回答
  •  无人及你
    2021-01-25 17:05

    This may be what you want.

    string s="select field1 dfd t1 (select field1 from t1)select field1 from t1";
    Regex r=new Regex(@"(?<=\)|^)\bselect\b.*?\bfrom\b.*?(?=\()",RegexOptions.RightToLeft);
    r.Replace(s,"HELL yeah");
    

提交回复
热议问题