Regex syntax to show all values captured

Hi Guys,

Attached a snip, Ive regexed a text file with 3 seperate email adresses, in the 3 seperate message box’s I have the individual emails, works perfectly.
Please, what is the syntax for all 3 combined in 1 message box :thinking:

Thanks

Screenshot 2022-04-19 181019

Which DataType is RegexEmailOutput?

Give a try at
String.Join(", ", RegexEmailOutput.Select(Function (x) x.Value))

DataType is Ienumerable Match

Works perfectly, is it possible to have them indexed ?
As in…

0 Tom@amazon.com
1 Jack@ebay.com
2 Bill@apple.com

Many thanks :grinning:

Screenshot 2022-04-19 182821

String.Join(", ", RegexEmailOutput.Select(Function (x, i) i.toString & " " & x.Value))

1 Like

Beautiful :grinning:

Thank you very much.

Ps, any idea where that trailing 3 in the last msg box coming from ?

String.Join(“”, RegexAmountOutput.Select(Function (x, i) i.toString & " " & x.Value))

Thanks again.

Screenshot 2022-04-19 192247
Screenshot 2022-04-19 193041
Screenshot 2022-04-19 193017

have a count check with RegexAmountOutput.Count()

Count is 4
I changed the text file values to 400,500,600 just to see if that 3 appeared again, it does.
As stated, the count is 4.
Is it pulling in the next index, as in number 3 ?
I did alter your code to remove commas and a space.
This below code that produces the trailing 3.
String.Join(“”, RegexAmountOutput.Select(Function (x, i) i.toString & " " & x.Value))

Thank you for being so helpful

Screenshot 2022-04-19 202435

looks more about the regex pattern issue, as this is producing the fourth count

Hmmmm :thinking:
I could have sworn it was something to do with the next index number as its always 3

Both of these give the trailing 3
(?<=Overdue\s:\s£|$|€).*
(?<=Overdue\s:\s£|$|€).+

Screenshot 2022-04-19 204220

Ahaaa, ive increased the text line count to 4, im sure its pulling the next index number.

Screenshot 2022-04-19 204648

just give a sample text and the description of what is to extract. It looks like a regex pattern issue causing the unneeded match

Below is the text file contents.
Concentrating on the Overdue amounts.

Tom@amazon.com
Jack@ebay.com
Bill@apple.com

Overdue : £400.00
Overdue : £500.00
Overdue : £600.00
Overdue : £700.00

The regex for the values, ive used 2 different just to see what was happening.
(?<=Overdue\s:\s£|$|€).*
(?<=Overdue\s:\s£|$|€).+

Its for when im pulling values, if I have more than one id like to know which one via the index number.
As in writing to excel,
If I want the value with the £500, it will be RegexAmountOutput(1)
If I want the value with the £700, it will be RegexAmountOutput(3)

The code in the msg box
String.Join(“”, RegexAmountOutput.Select(Function (x, i) i.toString & " " & x.Value))

:slightly_smiling_face:

as mentioned the problem is not the String.Join…

have a look on this pattern
grafik

Hi Peter, getting late at my end, will revisit tomorrow but I really appreciate ALL you help.
Still geting that trailing figure but now on the next line.
Im still convinced its pulling the next index number.

Reading 3 values gave me a trailing 3.
Reading 4 values gave me a trailing 4, albeit its now on the next line.

Tom@amazon.com
Jack@ebay.com
Bill@apple.com

Overdue : £400.00
Overdue : £500.00
Overdue : £600.00
Overdue : £700.00
Hello 1234

Regex : (?<=Overdue\s:\s£|$|€)[\d.,]+

Screenshot 2022-04-19 210957

grafik

Hi Peter,

Many thanks again for all your help.
Ive attached a few pics if would take a look please.

First one is exactly how I wanted it, the emails with an index number.
Second one, the values are all on same line, would really appreciate if you could adjust the string so I can have the values output like they are in the email list.
Ive also attached the write line output, as you can see its perfect.
I can also write 4 message boxs etc which give me the individuals at their index numbers.
RegexAmountOutput(0) 400.00
RegexAmountOutput(1) 500.00
RegexAmountOutput(2) 600.00
RegexAmountOutput(3) 700.00

Below is the string for the values msg box, I tried copy/paste the email string hoping it would output the same but alas no.
Just to repeat if you could adjust the string to output the values like the email

String.Join(“|”, RegexAmountOutput.Cast(of Match).select(Function (m, i) i.toString & " " & m.Value))

Regex used “(?<=Overdue\s:\s£|$|€)[\d.,]+”

Text file
Tom@amazon.com
Jack@ebay.com
Bill@apple.com

Overdue : £400.00
Overdue : £500.00
Overdue : £600.00
Overdue : £700.00
Hello 1234

Screenshot 2022-04-20 171235

Screenshot 2022-04-20 171252

Screenshot 2022-04-20 171319

had you tried:
String.Join(Environment.NewLine, RegexAmountOutput.Cast(of Match).select(Function (m, i) i.toString & " " & m.Value))

1 Like

Perfecto !!! :grinning:
Brilliant, many thanks buddy.

Screenshot 2022-04-20 181219

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