hi,
I have de texts in Variable: VPedidoLoja1
“Pedidos de compra foram gerados com sucesso.
Pedido(s) Gerado(s): 455047, 455048
Deseja Emití-los agora ?Pedidos de compra foram”
and
Variable: VPedidoLoja2
“Pedidos de compra foram gerados com sucesso.
Pedido(s) Gerado(s): 455049
Deseja Emití-los agora ?Pedidos de compra foram”
I m using a regex regular RegularExpressions “\d{6}[,]?” to mach the numbers
455047, 455048 fist Variable
455049 second variable
i need show this retuns in a Mensagem box
“Pedido Loja 1: " +System.Text.RegularExpressions.Regex.Matches(VPedidoLoja1,”\d{6}[,]?“).Tostring+
“Pedido Loja 2: " +System.Text.RegularExpressions.Regex.Matches(VPedidoLoja2,”\d{6}[,]?”).Tostring
but when I run uipath, it dont return machs
if i use:
“Pedido Loja 1: " +System.Text.RegularExpressions.Regex.Match(VPedidoLoja1,”\d{6}[,]?“).Tostring+
“Pedido Loja 2: " +System.Text.RegularExpressions.Regex.Match(VPedidoLoja2,”\d{6}[,]?”).Tostring
it just return the firts mach of each Variable:
Pedido Loja 1: 455047, Pedido Loja 2:455049
how can i show in a mensage box the first and the second mach when i use System.Text.RegularExpressions.Regex.Matches?
Gokul001
(Gokul Balaji)
November 3, 2022, 2:56pm
2
Hi @Felipe_Moura
Need give the (0)
Depends on the output
System.Text.RegularExpressions.Regex.Matches(VPedidoLoja1,”\d{6}[,]?“)(0)+VbNewline+System.Text.RegularExpressions.Regex.Match(VPedidoLoja2,”\d{6}[,]?”)(1)
Regards
Gokul
Thx,
i use you extression in my menssage box like this:
“Pedido Loja 1:” +System.Text.RegularExpressions.Regex.Matches(VPedidoLoja1,”\d{6}[,]?“)(0).Tostring+System.Text.RegularExpressions.Regex.Matches(VPedidoLoja1,”\d{6}[,]?“)(1).Tostring+
Environment.NewLine+
“Pedido Loja 2:” +System.Text.RegularExpressions.Regex.Matches(VPedidoLoja2,”\d{6}[,]?“)(0).Tostring+System.Text.RegularExpressions.Regex.Matches(VPedidoLoja2,”\d{6}[,]?“)(1).Tostring
for VPedidoLoja1 - "Pedidos de compra foram gerados com sucesso.
Pedido(s) Gerado(s): 455047, 455048
Deseja Emití-los agora ?Pedidos de compra foram” where uipath fond 2 mach this work very well.
but for VPedidoLoja2 - “Pedidos de compra foram gerados com sucesso.
Pedido(s) Gerado(s): 455049
Deseja Emití-los agora ?Pedidos de compra foram” where there is just 1 mach the uipath return
the problem is: I don’t know if the mensagem will be like VPedidoLoja1( 2 mach) or VPedidoLoja2(1 mach).
Gokul001
(Gokul Balaji)
November 3, 2022, 4:22pm
4
Can you share the sample input and output @Felipe_Moura
input variable VPedidoLoja1 :
“Pedidos de compra foram gerados com sucesso.
Pedido(s) Gerado(s): 455047, 455048
Deseja Emití-los agora ?Pedidos de compra foram” well.”
output: 455047, 455048
input variable VPedidoLoja2 :
“Pedidos de compra foram gerados com sucesso.
Pedido(s) Gerado(s): 455049 (“, 455050” sometimes)
Deseja Emití-los agora ?Pedidos de compra foram”
output: 455049 (“, 455050” sometimes)
“Pedido Loja 1:” +System.Text.RegularExpressions.Regex.Matches(VPedidoLoja1,”\d{6}[,]?“)(0).Tostring+System.Text.RegularExpressions.Regex.Matches(VPedidoLoja1,”\d{6}[,]?“)(1).Tostring+
Environment.NewLine+
“Pedido Loja 2:” +System.Text.RegularExpressions.Regex.Matches(VPedidoLoja2,”\d{6}[,]?“)(0).Tostring+
System.Text.RegularExpressions.Regex.Matches(VPedidoLoja2,”\d{6}[,]?“)(1).Tostring
This part sometime will not mach, becase will not existe mach(1) in my text.
how can say to uipath if not exist mach(1) ignore it ?
Gokul001
(Gokul Balaji)
November 4, 2022, 4:38am
6
Hi @Felipe_Moura
How about this expression
System.Text.RegularExpressions.Regex.Matches(YourString,"\b\d{6}\b")(0)
System.Text.RegularExpressions.Regex.Matches(YourString,"\b\d{6}\b")(1)
System.Text.RegularExpressions.Regex.Matches(YourString,"\b\d{6}\b|\(\W.*\)")(0)
Regards
Gokul
Hi @Gkul001 ,
i soleved if using this expression Regex
“Pedido Loja 1:” +System.Text.RegularExpressions.Regex.Match(VPedidoLoja1,“([0-9]{6})([,])?( )?([0-9]{6})?”).ToString+
Environment.NewLine+
“Pedido Loja 2:” +System.Text.RegularExpressions.Regex.Match(VPedidoLoja2,“([0-9]{6})([,])?( )?([0-9]{6})?”).ToString
thx for your help!
Gokul001
(Gokul Balaji)
November 4, 2022, 1:01pm
8
Great @Felipe_Moura
Gokul001:
System.Text.RegularExpressions.Regex.Matches(YourString,"\b\d{6}\b")(0)
System.Text.RegularExpressions.Regex.Matches(YourString,"\b\d{6}\b")(1)
You can also try with the above expression
System.Text.RegularExpressions.Regex.Match(YourString,"([0-9]{6})()?()?([0-9]{6})?")>ToString
Happy automation
Regards
Gokul
Felipe_Moura:
“Pedido Loja 1:” +System.Text.RegularExpressions.Regex.Matches(VPedidoLoja1,”\d{6}[,]?“)(0).Tostring+System.Text.RegularExpressions.Regex.Matches(VPedidoLoja1,”\d{6}[,]?“)(1).Tostring+
Environment.NewLine+
“Pedido Loja 2:” +System.Text.RegularExpressions.Regex.Matches(VPedidoLoja2,”\d{6}[,]?“)(0).Tostring+
System.Text.RegularExpressions.Regex.Matches(VPedidoLoja2,”\d{6}[,]?“)(1).Tostring
Hi @Felipe_Moura ,
When using the Expression with Matches we would need to Concatenate the collection values using String.Join, Check the modified expression below :
Also, Maybe the Regex Expression could be kept as the below, making it simpler :
\d{6}
"Pedido Loja 1: " + String.Join(",",System.Text.RegularExpressions.Regex.Matches(VPedidoLoja1,"\d{6}").Cast(Of Match).Select(Function(x)x.Value.Trim)).ToArray)+
"Pedido Loja 2: " + String.Join(",",System.Text.RegularExpressions.Regex.Matches(VPedidoLoja2,"\d{6}").Cast(Of Match).Select(Function(x)x.Value.Trim).ToArray)
system
(system)
Closed
March 22, 2024, 5:50pm
10
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.