Javascript: regular expressions

The tutor introduces Javascript regex.

Regex, aka regular expressions, is a programming concept. One regex function searches input for a given pattern, then reports presence or absence. Another, upon finding the pattern, might change it among the rest of the input – or else remove the pattern.

The input field below accepts user input. Then, when the button is clicked, a Javascript regex function weeds the non-numeric characters from the input. The input, weeded of non-numeric characters, is reported beneath the button.



Weeded input:

I’ll be explaining the workings behind this utility in a future post:)

Source:

w3schools.com

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Leave a Reply