How to use the xregexp.test function in xregexp

To help you get started, we’ve selected a few xregexp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GreenImp / rpg-dice-roller / src / dice-roll.js View on Github external
segments.map(segment => {
              // determine if the segment is a die or not
              if (XRegExp.test(segment, dieRegex)) {
                // this is a die - parse it into an object and add to the list
                parsed.push(...parseDie(segment));
              } else {
                // not a die (ie. number, operator)
                if(diceUtils.isNumeric(segment)){
                  segment = parseFloat(segment);
                }

                // add to the list
                parsed.push(segment);
              }
            });
          }
github angular / angular / aio / tools / firebase-test-utils / FirebaseGlob.ts View on Github external
test(url: string): boolean {
    return XRegExp.test(url, this.regex);
  }
github rse / componentjs / doc / component-api.js View on Github external
txt = xre.replace(txt, xre("([ \\t]+)\\.([ \\t]+)(.+?\\n(?:\\1 \\2.*?\\n)*)", "sg"), "<li>$3</li>");
                    txt = conv(0, txt);
                    html_spec += "<ul class="\&quot;list\&quot;">";
                    html_spec += txt + "\n";
                    html_spec += "</ul>";
                }
                else if (xre.test(txt, xre("^\\s*\\+\\s", "s"))) {
                    txt = xre.replace(txt, xre("^\\s*\\+\\s", "mg"), "");
                    txt = conv(0, txt);
                    txt = xre.replace(txt, xre("^(.+)$", "mg"), "$1");
                    txt = xre.replace(txt, xre("(\\s+)\\+(\\s+)", "sg"), "");
                    html_spec += "";
                    html_spec += txt + "\n";
                    html_spec += "<table class="\&quot;tabular\&quot;"></table>";
                }
                else if (!xre.test(txt, xre("^\\s+$", "s"))) {
                    txt = conv(0, txt);
                    txt = xre.replace(txt, xre("[ \\t]{2,}", "sg"), " ");
                    html_spec += "<div class="\&quot;desc\&quot;">";
                    html_spec += txt + "\n";
                    html_spec += "</div>";
                }
            }
github spywhere / vscode-mark-jump / src / extension.ts View on Github external
            pattern => XRegExp.test(content, XRegExp(pattern))
        );
github spywhere / vscode-mark-jump / src / extension.ts View on Github external
return this.patterns.some(pattern => {
            return XRegExp.test(lineText, XRegExp(pattern));
        });
    }
github rse / componentjs / doc / component-api.js View on Github external
function parse5b (txt) {
                if (xre.test(txt, xre("^\\s*\\|\\s", "s"))) {
                    txt = xre.replace(txt, xre("^\\s*\\|\\s", "mg"), "");
                    txt = conv(0, txt);
                    txt = xre.replace(txt, xre("\\n+$", "s"), "");
                    txt = xre.replace(txt, xre("^\\s+", "s"), "");
                    html_spec += "<div class="\&quot;example\&quot;">";
                    html_spec += txt + "\n";
                    html_spec += "</div>";
                }
                else if (xre.test(txt, xre("^\\s*Notice:\\s+", "s"))) {
                    txt = conv(0, txt);
                    html_spec += "<div class="\&quot;notice\&quot;">";
                    html_spec += txt + "\n";
                    html_spec += "</div>";
                }
                else if (xre.test(txt, xre("^\\s*\\.\\s", "s"))) {
                    txt = xre.replace(txt, xre("([ \\t]+)\\.([ \\t]+)(.+?\\n(?:\\1 \\2.*?\\n)*)", "sg"), "<li>$3</li>");
                    txt = conv(0, txt);
                    html_spec += "<ul class="\&quot;list\&quot;">";
                    html_spec += txt + "\n";
                    html_spec += "</ul>";
                }
                else if (xre.test(txt, xre("^\\s*\\+\\s", "s"))) {
                    txt = xre.replace(txt, xre("^\\s*\\+\\s", "mg"), "");
                    txt = conv(0, txt);
                    txt = xre.replace(txt, xre("^(.+)$", "mg"), "$1");