Action

Un-Escape Regex Special Characters

Posted by ericalinhu, Last update over 1 year ago

Un-Escape Regex Special Characters

Steps

  • script

    var s = draft.content;
    s = s.replace(/\\\//g, "\/");
    s = s.replace(/\\\./g, "\.");
    s = s.replace(/\\\^/g, "\^");
    s = s.replace(/\\\?/g, "\?");
    s = s.replace(/\\\*/g, "\*");
    s = s.replace(/\\\+/g, "\+");
    s = s.replace(/\\\(/g, "\(");
    s = s.replace(/\\\)/g, "\)");
    s = s.replace(/\\\|/g, "\|");
    s = s.replace(/\\\}/g, "\}");
    s = s.replace(/\\\{/g, "\{");
    s = s.replace(/\\\$/g, "\$");
    s = s.replace(/\\\]/g, "\]");
    s = s.replace(/\\\[/g, "\[");
    s = s.replace(/\\\\/g, "\\");
    draft.content = s;
    draft.update();

Options

  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.