RegExp add space

Hi Guys,

Just want to ask about the ReGex code, currently having issue where someone added a document with a space on the filename, the URL on the email notification gets cut off.

I used this RegExp code: (just got this on searching the internet)
const convertRegex = new RegExp(/wix:document://v1/([^/]+)/(.*)$/);

and the URL on notification looks like this

the link gets broken on the first period


This doesn’t look like a regex issue. You can’t have spaces in urls, you need to escape them.

If you whish to get rid of the spaces you can do something like:

url = url.split(' ').join('');

To encode the spaces as URL (which is probably what you want, see above).

Alex, to encode spaces as uri, you need to use encodeURI() not encodeURIComponent().
But any way I think Jesse wanted to remove the spaces (wrong spaces)
I’ve read it again, and I think you’re right (that Jesse wanted to encode the space, so encodeURI() is the solution).

Thank you for the reply guys. I will try this one out