I found this in a message forum, I don’t know regex so I was hoping you could explain it to me or give me a better solution.
StrippedPrefix_JS_ItemNo = StrippedPrefix_JS_ItemNo.replace(/,$/,'');
What is the opening / for?
$ is end of line, I know that much, and I can see the empty replace ''.
the
/expression goes here/is how javascript can define a regular expression. Without the/:That’s a syntax error. So the slashes mark it as an expression. It can also be written,
var expression = new RegExp(",$");.More Info about JavaScript RegExp