Correct way to do a string replace with regex in javascript? -
i newbie regex , expression appears backwards or opposite of trying do. have string, in case url, , want replace , including last forward slash empty string. have
"http://www.sweet.com/member/other".replace(/[^/]+$/, "")
which opposite of want. proper expression results i'm seeking? in case end string "other"? help
you want regex matches beginning of string, followed many characters possible, followed slash:
/^.*\//
Comments
Post a Comment