Obtain regex corretly

Hi guys, I need to send the path in regex literally. how please?

Hey

You need to ‘escape’ the character.

Use the “\” to escape any character.

So,
Option 1:
“\\” (string) = “\\\\” (in regex).

Option 2:
Or you can insert the following when you need to match ‘1 or more’ backslashes:
[\\]+

Option 3:
Or you could use:
\W+

(Note - where did you copy this path from? Just be aware that if you copied it from the locals panel in Studio the extra “\” characters are not ‘real’.)

Hopefully this helps :blush:

Cheers

Steve

1 Like

Hi,

FYI, if it’s necessary to get directory name or file name, the following expression will help you.

Directory name

System.IO.Path.GetDirectoryName(yourFilePath)

File name

System.IO.Path.GetFileName(yourFilePath)

Regards,

2 Likes