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

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -