javascript regular expression

regular expression params:

  • g - global matching
  • m - multiline
  • i - case-insensitive matching

var reg_exp = /pattern/gmi;

regular expression example:


var no_letters = 'abc123XYZ'.replace(/[a-z]/gmi, '');

console.log(no_letters); // return '123'

Leave a Comment