Error with regex expression


my expression is: String.Join(“,”,System.Text.RegularExpressions.Regex.Matches(txtPython,“[.*]”,RegexOptions.MultiLine).Cast(Of Match).Select(Function(x) x.value))

Hi @amanda.gondim
can you try with below expression.

Dim result As String = String.Join(“,”, System.Text.RegularExpressions.Regex.Matches(txtPython, “[.*?]”, RegexOptions.MultiLine).Cast(Of Match)().Select(Function(x) x.Value))

hope it works!!!

@amanda.gondim,

I’m not getting the exact error from screenshot due to language barrier but if the error is saying that Regex is not declared then import this namespace
System.Text.RegularExpressions
from Import panel on the bottom of the workflow.

Thanks,
Ashok :slight_smile:

we would recommend importing the System.Text.RegularExpressions namespace
RegexImport

Then you can shorten also the statement to:

String.Join(",",Regex.Matches(txtPython,"\[.*\]",RegexOptions.MultiLine).Cast(Of Match).Select(Function(x) x.value))

Did you copy/paste the System.Text.RegularExpressions part? Don’t copy/paste expressions like that. You have to type them out so it’ll do the imports. Copy what you have here, paste it into Notepad to save it, clear out the expression in the Assign, and click Save. Then edit it and type the entire expression manually.