Usage of double Quotes in Regex value in UIPath

Hello There,

I am trying to use double quotes with in the regex expression. However, as we all know that double quotes will be considered as a string. I was wondering if we can get over this and find a solution over here.

Ex: system.Text.RegularExpressions.Regex.Match(“This is a sample ‘sap’”,“'.*'”)---- This works fine.

system.Text.RegularExpressions.Regex.Match(“This is a sample “sap””,“'.*'”)---- This does not work fine.
If we replace single quotes for sap with double quotes, it will throw up an error. Do we have a solution for this case?

Thanks,
Ajay

Double quotes are not special in regex, so you only need to add them to your string

Hi.

first off, you need to embed the inner quotes in your string. You can do this by using 2 quotes, like this:
image

Then for pattern, you can change the quotes in brackets to look for both single and double quotes.
You can also use a look behind and ahead to pull in only the text between the quotes using ?<= and ?=

All in all, it would look like this:
image

Regards.

Estou gerando uma tabela a partir de uma string mas a mesma esta acrescentando aspas duplas no valor como exemplo.
image

Usei a expressão conforme sua orientação, e o valor ficou como null.

Alguém pode me ajudar por favor?

Obrigado.

Any Special Character if you want to print like double quotes
Input = “Hello”
Output = “Hello”
Solution : Chr(34) + “Hello” +Chr(34)

Any special character can be print, just have to pass ASCII value of the special character EX: Double Quotes : 34

Hi @AjayKumar
Try this:

System.Text.RegularExpressions.Regex.Match("This is a sample \"sap\"", "'.*'")

Hope it helps!!