The regular expression for a string that ends with '/' is the following:
but the // makes the compiler think it's a comment. how to work around this?
You must escape the final
/ so the interpreter doesn't think it terminates the RegExp literal:
You need to escape the slash:
Use the escape character (
\) to specify a literal / as in:
You'll need to escape the slash
If you want to match a string that ends with slash, you may want to include the actual string too;
©2020 All rights reserved.