I have just created a string that should replace a word starting with #. I succeed in doing that but as soon as i add slash after # in the string, it does replace it. This is my code
<script>
var messageString = "The folder #/folder_name was removed from the workspace #workspace_name by #user_name"
result = messageString.replace(/#(\w+)/g, function(_, $1) { return " HELLO"; })
alert(result );
</script>
My question is why its not working when i add a slash after the # and how can i replace the word which has / also. Thanks in advance