How to manipulate an object extracted by Regex and Match

Hi all. I’m having trouble manipulating an object generated by “Matches” activity. My goal is to manipulate the string patter extracted by Regex before writing it in excel.

Since “Matches” activity outputs an IEnumerable variable then using a “For each” to get each item inside.

I need to manipulate this before I write the string into excel. Getting an error “options strict on disallows late binding”. Also getting an error when changing “Type argument” in the foreach properties to “string” instead of object.

Here is the work flow below

Hey!

Could you please show us the input and also expected output…

Will give you the string regex to extract the pattern…

Regards,
NaNi

can you upload the xaml here @Bennyhana

The regex isn’t exactly the problem as I’m able to extract what I need from the document. What I’m having trouble is actually manipulating the results from the “Matches” activity as it comes out as an IEnum variable. The current work around for this problem is write the Matches result in a cell, grab the value in that cell and then manipulate it in a for each activity as seen below. Anyway to make this easier would be great and appreciated!

@Bennyhana

replace ClinAmount with

ClinAmount.Groups(1).Value

Hey!

Instead of iEnumarable you can use simple string…

Assign OutVariable = System.Text.RegularExpressions.Regex.Match(InputVariable,Pattern).ToString

This will give you the string type…

Then write cell and read cell…

Regards,
NaNi

@Bennyhana Try this within the Assign Activity instead of ClinAmount in the left side take a variable of type string

Ex

Output = ClinAmount.substring etc.....

Hey @Bennyhana

The ienumerable variable can be tricky :wink:

Take a look at this video.

You can use an assign to get the result as a string.

Take a look here to learn more about Regex…

Cheers

Steve

we would assume that the ClinAmount is the outcome from the matches activity. If so, the set the Typeargument of the for each to System.Text.RegularExpressions.Match

Feel free also to pass ClinAmount.ToList to the for each activity to overcome the restrictions of the IEnumerable we do have in some cases

Hey all, tried all the suggested solutions and still having the same error unfortunately. Here is the main thing I am confused about:

Matches activity grabs all the matches in the text according to the regex pattern, which makes the IEnumerable variable make sense.

Then when I try to reiterate through each result in the IEnumerable result, I’m able to write it to a cell as a string. However, I can’t manipulate that string. Please see screenshot below to add context to my question.

This is the workflow and error message. CLINS to string work. But manipulating this string doesn’t

Assigning it as string first doesn’t help either

Here are more details
Variable type:


Type Argument:

I’ve tried changing typeargument to string as well, with no success.

Please let me know your thoughts. Thanks!

ensure following:
RegexImport

what is the last remaining validation message in detail?

feel free to share your xaml with us