Sesame Sesame - 6 months ago 6
Javascript Question

Find character pattern using regex

I am trying to find all occurrences of a special character

surrounded by either letters or numbers.

After many tries, I have come up with the following Regex that almost does what I need:


This works fine for these examples:


However, it fails if there are two forward slashes together:

In this case, it matches the second forward slash after
which I do not want.

How can I modify this Regex to meet my needs?

EDIT: I do not want to a match when two forward slashes are together. I only want to match if a single forward slash is surrounded by alphanumeric characters.


you would need a positive lookbehind group, like so:


however, according to it is not supported in javascript.

Works fine in e.g. python