Although Epression Works Fine, Matches Activity Doesn't Return A Value

Hi All

It is me again :frowning:
I hope you are well.

I have a problem that I couldn’t figure out. Here it is:

1-) I have a text:
"2481 Fetosa Drive

Llano, Texas

Pin cme 78643

TIN: 14122226739"

2-) I need to match “Llano” just before Texas.
As you can see my expression works fine on regexr.com and also Matches Activity.
“(?<=([^\n]\n){2})[^\n](?=,)”

Regex
Regex 2

3-) I open the properties panel and type “city” as a new var into the result space. I also type input and pattern.

4-) When I want to see the result on output panel, I use code below in write line activity;
“city.first().ToString”

5-) Unfortunately, I receive “Sequence contains no elements” error.

6-) When use “city(0).Value” I receive “Object Referene not Set to an Instance of an Object” error.

I checked scope. Its scope is sequence.

I really couldn’t figure out the problem. What is wrong? Doesn’t matches activity return a result? Or is there somehing that I am missing?

Thank you for your help in advance.
Sincerely

Hey!

Texas is fixed for every time or this will keep on change?

If it is fixed try this:

System.Text.RegularExpressions.Regex.Match(InputString,".*(?=, Texas)").ToString

Regards,
NaNi

Hi, nothing is fixed here. Only “,”, “Pin cme” and “TIN:” are fixed.
Why matches activity doesn’t return a value even it works in testing? :frowning:

Linebreaks in Windows are composed by \r\n
int the tools / previews you dont have

so just replace \ by \r?\n to make it more generic

Hey!

There is no match found with that pattern

we will suggest you to use the String instead of Ienumerable

Try this regex:

Assign Text = System.Text.RegularExpressions.Regex.Match(InputString,".*\n\n+(?=Pin cme)").ToString

This will give you the Entire line text

Use String manipulation like this:

Text.Split(","c)(0)

This will give you the expected output

Reference:

Regards,
NaNi

Hi, it doesn’t work.

I started from the beginning and errors just gone.
I think I should program clearly. I think many affects make errors emerge.

Thank you for your help.
I am very appreciated. :slight_smile:

1 Like

Hi, it doesn’t work.

I started from the beginning and errors just gone.
I think I should program clearly. I think many affects make errors emerge.

Thank you for your help…
I am very appreciated. :slight_smile:

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