Regex pattern giving two matches but im getting the first answer only

i have a pattern System.Text.RegularExpressions.Regex.Matches(bodyval,"\d{2}/\d{2}/\d{4}")(0).Value.ToString which will give match as dd/mm/yyyy
but when i have two dates in the same paragragh im getting the frst date only

Hi,

Hope the following helps you.

matches is MatchCollection type variable.

Regards,

1 Like

i have variable named strval for regex pattern (matches in ur case). do i need to change the variable because item.value doesnt exist.value functio is not there for item

Hi,

Can you set "System.Text.RegularExpressions.Match" type in TypeArgument property of For Each activity? Probably this will solve your matter.

Regards,

1 Like

i have changed it but its throwing error

Hi,

Can you share the error message and which activity?

actually it is not error msg item.value is not coming
item is only there value is not there in dropdown

Hi,

Can you check if your strVal type is matchCollection type and the 2nd Assing is as the following?

strval = System.Text.RegularExpressions.Regex.Matches(bodyval,"\d{2}/\d{2}/\d{4}")

Regards,


now this error

Hi,

Your strVal seems not MatchCollection type but String type.

Can you set strVal as MatchCollection type in Variable panel

and

set 2nd Assign activity as the following. (no need (0).Value at the end of Value property)

strval = System.Text.RegularExpressions.Regex.Matches(bodyval,"\d{2}/\d{2}/\d{4}")

Regards,

1 Like

if i set strval as match collection it is throwing error in regex variable value

Hi,

The Value property should be the following. No need .Value.toString at the end of the value.

System.Text.RegularExpressions.Regex.Matches(bodyval,"\d{2}/\d{2}/\d{4}")

Regards,

1 Like

i ll try this and tell u thanks

1 Like

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