jquery - combining removing of numbers and underscores regex javascript -
i awful @ regex, , have been trying teach myself.
in order practice trying remove numbers , underscores string.
i have been able remove numbers following, combination of both bamboozling me.
var name = $(this).attr('id').replace(/\d+/g, '');
i not sure how combine two. following 1 of many efforts no avail.
var name = $(this).attr('id').replace(/\d+/\/_/g, '');
you need use character class [\d_]
match digit or underscore.
here small demo:
console.log("some_1234_6789 demo.".replace(/[\d_]+/g, ''))
Comments
Post a Comment