JavaScript – Make a RegEx Text Tool

Plenty of Regular Expressions tools are available in the net. Most of them are free and quite quick. I have actually never thought that building such a tool can be done rather quickly, as far as the RegEx is part of JavaScript and is quite fast to work, once you know what you are doing.

Thus, this week I have decided to build a RegEx tool at vitoshacademy.com and I have managed – vitoshacademy.com/regex

Pretty much it is not much of philosophy – the JavaScript reads the input text and the RegEx and starts looking for a regex match. Once it is found, the input text is sliced (with my_text slice) and it continues looking further. All the results are written in the variable arr_result. At the end, each of the results in the variable arr_result is added to the results. Thus, we get something like this at the beginning:

regex_01

And after we write w{6,}, requesting all words equal or above 6 letters, we get this:

regex_02

The code is rather simple, but it is ok 🙂

This is the JScript:

And the HTML:

The whole code, with the few lines of CSS is available in my GitHub account here.

Enjoy it! 😀

About

VBA Developer

Tagged with: ,