Problem with using system.Text.RegularExpression.Regex.Match

system.Text.RegularExpressions.Regex.Match(fileName, “(?<=.().*(?=))”)

Just a question…has anyone run into this? I have this on two different automations. Both use the same activity package versions. One automation I have no issues with. The second automation I get the following “Compiler error(s)…Text is not a member of string.”

In both automations System.Text.RegularExpressions is in imports. If I use just Regex.Match and the expression the automation only hits on a portion of the sample set even though a regex test matches all files in the sample set…Thoughts?

My guess is that you have a variable called system of type string. Rename that variable to something else, e.g. system1 and it should solve your issue.

I thought of that and there is no other variable with system. I am doing a code review on this one from another developer and I cannot figure this one out. I will send it back to him to use the matches activity and iterate through the table. Thanks though!


maybe you can also share the pattern by using the format button from the editor (asterisk triggers italic text …)

We do understand that you interested on text contained between brackets. It is recommended to check for needed escapes which are to use

Ok, that’s weird. There should be no difference between System.Text.RegularExpressions.Regex.Match() and Regex.Match() since they both refer to the same function.

Thanks…I already forwarded it back to the developer to use the matches function and iterate through the resulting enumerable table

Hi @Chris_Bolin

Just raising this observation, my apologies if not related.

Are you not missing a “.tostring” at the end of the above syntax?

Should be:
system.Text.RegularExpressions.Regex.Match(fileName, “(?<=.().*(?=))”).Tostring

The import will just simplify the syntax to remove “System.Text.RegularExpressions”.




Import the following in the studio…



And then your expression should be

system.Text.RegularExpressions.Regex.Match(fileName, “(?<=.().*(?=))”).ToString



Thanks for your reply… it’s already there.

Solved this with a different approach

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.