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

Popular posts from this blog

php - trouble displaying mysqli database results in correct order -

depending on nth recurrence of job in control M -

sql server - Cannot query correctly (MSSQL - PHP - JSON) -