Regex.InfiniteMatchTimeout 欄位


指定模式比對作業不應逾時。Specifies that a pattern-matching operation should not time out.

public: static initonly TimeSpan InfiniteMatchTimeout;
public static readonly TimeSpan InfiniteMatchTimeout;
 staticval mutable InfiniteMatchTimeout : TimeSpan
Public Shared ReadOnly InfiniteMatchTimeout As TimeSpan 



類別Regex(String, RegexOptions, TimeSpan)的函式和一些靜態比對方法會InfiniteMatchTimeout使用常數來表示尋找模式比對的嘗試不應該超時。The Regex(String, RegexOptions, TimeSpan) class constructor and a number of static matching methods use the InfiniteMatchTimeout constant to indicate that the attempt to find a pattern match should not time out.


將正則運算式引擎的超時值設定為InfiniteMatchTimeout , 可能會導致依賴過量回溯的正則運算式似乎在處理幾乎符合正則運算式模式的文字時停止回應。Setting the regular expression engine's time-out value to InfiniteMatchTimeout can cause regular expressions that rely on excessive backtracking to appear to stop responding when processing text that nearly matches the regular expression pattern. 如果您停用超時時間, 您應該確定正則運算式不依賴過量的回溯, 而且它會處理幾乎符合正則運算式模式的文字。If you disable time-outs, you should ensure that your regular expression does not rely on excessive backtracking and that it handles text that nearly matches the regular expression pattern.

如需處理回溯的詳細資訊, 請參閱回溯For more information about handling backtracking, see Backtracking.

常數可以提供為下列成員之matchTimeout引數的值: InfiniteMatchTimeoutThe InfiniteMatchTimeout constant can be supplied as the value of the matchTimeout argument of the following members: