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
Post a Comment