fudi5
(Piotr Fudala)
April 13, 2018, 7:37am
1
Hi,
I have been created variable type matchcollection where i got 3 column: First, Secend and Third. But i dont know how to take out one of the column. Can you guid me… the name of variable “x” so i need x… and what next to take out for example column first ?
Many thanks for help,
Regards,
@fudi5
arivu96
(Arivazhagan A)
April 13, 2018, 7:41am
2
fudi5:
matchcollection
matchcollection(0).ToString(), matchcollection(1).ToString(), matchcollection(2).ToString()
Regards,
Arivu
2 Likes
fudi5
(Piotr Fudala)
April 13, 2018, 7:53am
3
Hi @arivu96 ,
It dosen`t work. I got mesage: “Write line : Specified argument was out of the range of valid values.
Parameter name: i”
Regards,
@fudi5
arivu96
(Arivazhagan A)
April 13, 2018, 7:57am
4
Hi @fudi5 ,
how you used can you send the screenshot.
make sure the matchcollection should not be empty.
you can check using if condition matchcollection.Any
True->values available
False-> No data in the matchcollection.
matchcollection.count → you will get the collection data count.
Regards,
Arivu
fudi5
(Piotr Fudala)
April 13, 2018, 8:02am
5
@arivu96 ,
Im doing this:
1.windows assign
(x is variable matchcollection and
row(sekcja) looks like this:
3 10,11 1 -
)
system.Text.RegularExpressions.Regex.Matches(row(“sekcja”).ToString,“^(?<FIRST>(?:/\s)?(?:\w+(?:,\s\w+))|—)\s(?<SECOND>(?:/\s)?(?:\w+(?:,\s\w+) )|—)\s(?<THIRD>(?:/\s)?(?:\w+(?:,\s\w+)*)|—)$”)
writeline
x(0).tostring
Regards,
@fudi5
arivu96
(Arivazhagan A)
April 13, 2018, 8:07am
6
Hi @fudi5 ,
fudi5:
row(“sekcja”).ToString
can you tell me what value you will get??? in row("sekcja").ToString
Regards,
Arivu
arivu96
(Arivazhagan A)
April 13, 2018, 8:11am
8
fudi5:
3 10,11 1 -
i think no data match based on your regex pattern.
Use this link to test the regex pattern
Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET, Rust.
Regards,
Arivu
fudi5
(Piotr Fudala)
April 13, 2018, 8:14am
9
Ok i know what can be wrong. Many thanks for help.
I`ll let know.
Regards,
@fudi5
fudi5
(Piotr Fudala)
April 13, 2018, 8:26am
10
I have been changed patter and now it take this case but still dosent work:
^(?(?:/\s)?(?:\w+(?:,\s\w+))|—)\s(?(?:/\s)?(?:\w+(?:,\s\w+) )|—)\s(?(?:/\s)?(?:\w+(?:,\s\w+)*)|—)$
arivu96
(Arivazhagan A)
April 13, 2018, 9:20am
11
Hi @fudi5 ,
For testing regex pattern use the below link.
Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET.
Regular Expression : ->your regex pattern
Test String → you input
Regards,
Arivu
fudi5
(Piotr Fudala)
April 13, 2018, 10:15am
12
@arivu96
I tested it before you sent link.
Now its working fine i just changed pattern.
Regards,
@fudi5
fudi5
(Piotr Fudala)
April 13, 2018, 1:20pm
14
This is SOLUTION:
system.Text.RegularExpressions.Regex.Match(row(“sekcja”).ToString,"
(?(?:/\s)?(?:\w+(?:,\s?\w+))|—)"+
“\s”+
"(?(?:/\s)?(?:\w+(?:,\s?\w+) )|—)"+
“\s”+
“(?(?:/\s)?(?:\w+(?:,\s?\w+)*)|—)”)
1 Like