javascript - Match two string patterns at the same time with regex for removal -


a quick question string manipulation in javascript.

i have files named pattern:

content_filename content_big_filename 

the filename in variable, cannot take last 8 chars. need extract filename.

now i'm using

string.replace( /\/content_/, '' ) need support content_big.

how should go this?

if it's last part after underscore, split , pop

str.split('_').pop(); 

document.body.innerhtml += "content_filename1".split('_').pop() + '<br>';  document.body.innerhtml += "content_big_filename2".split('_').pop()


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -