Regex is not working - probably user error. Help appreciated

Hi,

I would like to transform the following link such that any contents after the last "slash" character are removed:

  • brain://xTYWKpB9VU2egO6JhqtDZg/ThisIsDummyText

So this would be the result:

  • brain://xTYWKpB9VU2egO6JhqtDZg/

However, after running the following steps in the macro with the original text in the clipboard, the clipboard appears to remain unchanged and the original link gets pasted.

The Regex expression should be correct, but I must be doing something wrong inadvertently. Would highly appreciate your input.

No, it's not, test it use any regex tool again:

You must escape backslash character

Try this

brain:\/\/.*\/(.*)

Why use wildcard characters instead of [a-zA-Z0-9]?

Duh! I do know that certain characters need to be escaped but completely forgot in this case.

Also, for some reason the application I use to check RegEx expressions didn't flag this. No excuses though :innocent:

Thanks, problem solved.

1 Like

Just use this
image

My understanding is that it's necessary because these links sometimes contain underscores, i.e. they are not always alphanumeric.