Skip to main content

regexp_escape_static

Function regexp_escape_static 

Source
pub(crate) fn regexp_escape_static(
    _it: &mut Interp,
    _t: Value,
    a: &[Value],
) -> Result<Value, Value>
Expand description

RegExp.escape(str)(ES2025)。ユーザー入力を正規表現の構文文字として解釈させない ために new RegExp(userInput) へ渡す前に使う定番イディオム向け。RegExp 構文上の 特殊文字(^ $ \ . * + ? ( ) [ ] { } | /)と一部の空白系制御文字をエスケープする 簡略実装(Unicode プロパティエスケープ等が絡む厳密なコーナーケースは対象外)。