Do i have to escape slashes when putting them into regular expression?
myString = \'/courses/test/user\'; myString.replace(/\\/courses\\/([^\\/]*)\\/.*/, \"$
/[\/]/g matches forward slashes. /[\\]/g matches backward slashes.
/[\/]/g
/[\\]/g