[英]RegEx.Escape ignoring parenthesis
使用RegEx.Escape
是否可以忽略用於分組/捕獲的括號?
RegEx.Escape("profile.php?user_id=([0-9]+)");
當前它將轉義([0-9]+)
部分。
我不確定是否可以,但是由於這是正則表達式的實際部分,它可以進行匹配並且不需要轉義,因此可以使用:
string regex = Regex.Escape("profile.php?user_id=") + "([0-9]+)";
不,這是不可能的,除非您將其拆分>>
string s = Regex.Escape("profile.php?user_id=") + "([0-9]+)";
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.