javascript - return substring match -


i trying part of string regex

this string testing

class1 container _box _box_cec493

the string series of classes applied element.

what cec493 changes since regex applied bunch of different elements (therefore string 1 above)

the regex using is

/\s_box_([0-9a-za-z]+)/

which returns

_box_cec493, cec493

how can modify in order second value (cec493)?

thank you

you split string:

var str = "class1 container _box _box_cec493"; var match = str.split('_').pop(); alert(match); 

demo


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -