JavaScript Regex tester

This is a little JavaScript Regex tester, just write your Regex as example "\d" or "\w" and a test string like "123abc". It is more like an example as an real use function, but you can see how it works and handle the matches. Try it:

function myFunction() {
if(document.getElementById("regex").value == ""){
document.getElementById("result").innerHTML = "No Regex";return(0);
var re = RegExp(document.getElementById("regex").value, 'g');
document.getElementById("result").innerHTML = 
RegExp.prototype.execAll = function(string) {
    var match = null;
    var matches = new Array();
    while (match = this.exec(string)) {
        var matchArray = [];
        for (i in match) {
            if (parseInt(i) == i) {
    return matches;
<textarea id="regex" rows="1" cols="50" onchange="myFunction()" onkeyup="myFunction()" placeholder="Your Regex here..."></textarea>
<textarea id="text" rows="4" cols="50"onchange="myFunction()" onkeyup="myFunction()" placeholder="Your Text here..."></textarea>
<div id="result"></div>

6 thoughts on “JavaScript Regex tester”

  1. Hello! Would you mind if I share your blog with my
    twitter group? There’s a lot of folks that I think would really enjoy your content.

    Please let me know. Cheers

  2. I visited many sites except the audio quality for audio songs current at this web page is in fact fabulous.

  3. Greetings! Very helpful advice in this particular article!
    It’s the little changes that produce the biggest changes.
    Thanks for sharing!|

  4. I simply want to say I am newbie to blogs and actually savored this blog site. Probably I’m likely to bookmark your website . You absolutely have incredible articles. Kudos for sharing with us your webpage.

Leave a Reply

Your email address will not be published.

14 + eleven =