Make a syntax highlighter for MySQL using JavaScript and Regex

View code Play Walkthrough

Description

Fun experiment to create a syntax highlighter using JavaScript and Regex.

Regex is used to match keywords, comments, special characters, etc which are then wrapped up in spans with classes to stylize the string.

Basic knowledge of Regex will be helpful, but if you are just starting out thats fine too. This walkthrough will take you through a basic example of things you can do with Regex.

Subscribe

Get updates about new walkthroughs, behind-the-scenes experiments, tips, tricks and more.

Add New Comment

3 Comments

(close)
Licson

Licson

I think you can leave the textarea there and attach an event listener to listen for changes. Then , it’ll become interactive.

hitautodestruct

hitautodestruct

Wow! This is great!
Nice job on the simplicity factor and the explanations.

Dillon

Dillon

This is great. Loving this site.

3 Comments

Description

5x 10x 15x 20x