Mr.H
1
Hi Everyone.
I have a string as below… I have used regex to extract the string as below picture.
But how to customize to received length of cost when it change.
Thanks in advance!
My Code: [cC][ộỘ][nN][gG] *[tT][iI][ềỀ][nN] *[hH][àÀ][nN][gG] *( *[tT][oO][tT][aA][lL]) :-(.)\d{1,2} *% *\d{1,3}[,.]\d{1,3}
Thanks in advance!
Yoichi
(Yoichi)
2
Hi,
How about the following expression?
System.Text.RegularExpressions.Regex.Match(yourString,"(?<=\(Total\):.*?%\D?)[.,\d]+",System.Text.RegularExpressions.RegexOptions.IgnoreCase).Value
If this doesn’t work, can you share original text as a file?
Regards,
1 Like
Mr.H
3
Hi Bro.
I have tried but not success.
I have two string
-
This is total cost for your site - Cộng tiền hàng (Total): 181.818 10% 18.182.123 . pls arrange to pay before deadline
-
This is total cost for your site - Cộng tiền hàng (Total): 1.718.213 10% 11.819.829 . pls arrange to pay before deadline
I want to extract 4 substring:
- Cộng tiền hàng (Total): 1.718.213 10% 11.819.829
- 1.718.213
- 10%
- 11.819.829
Thanks in advance!
Yoichi
(Yoichi)
4
Hi,
Can you try the following?
System.Text.RegularExpressions.Regex.Match(yourString,"(?<=^.*?-\s).*?:\s([.,\d]+)\s(\d+%)\s([.,\d]+)")
Main.xaml (7.1 KB)
Regards,
1 Like
Mr.H
5
Thanks you very much bro!
1 Like
Mr.H
6
Hi Bro.
Sorry, i have another small question.
How to count number of Group when regex string ?
Thánks in advance!
Mr.H
7
Thanks you.
I have known count the number of groups
system
(system)
Closed
8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.