Kuro
(KuroObi )
November 9, 2022, 2:39pm
1
Hello, I’m starting with regex and I don’t understand it yet, I have two cases that I can’t find, the first is this, I need to locate the number that is just above Client, it can be a number or a text
city-
12345678X
Client
Number
in the second case, I need to put the content between Ser and Desc in a variable, it always has that format, thank you very much for the help
Ser
5814
01/11/2022
099
Desc
Gokul001
(Gokul Balaji)
November 9, 2022, 2:40pm
2
What do you need to extract from this string? @Kuro
Gokul001
(Gokul Balaji)
November 9, 2022, 2:41pm
3
HI @Kuro
Try with this Regex
YourString = “city-
12345678X
Client
Number”
System.Text.RegularExpressions.Regex.Match(YourString,"(?<=city\W\n)\S.*").Tostring
Regards
Gokul
Kuro
(KuroObi )
November 9, 2022, 2:50pm
4
Thanks for the answer, but “city” is changing, it is always different, Client is fixed
Gokul001
(Gokul Balaji)
November 9, 2022, 2:51pm
5
@Kuro
System.Text.RegularExpressions.Regex.Match(YourString,"\S.*(?=\nClient)").Tostring
Kuro
(KuroObi )
November 9, 2022, 2:57pm
6
works fine!!
I had another query, can you help me?
Anil_G
(Anil Gorthi)
November 9, 2022, 2:57pm
7
Hi @Kuro
you can use this
str is the string then str.Split(“Client”,2,StringSplitOptions.None)(0).Trim.Split(Environment.Newline(),2,StringSplitOptions.None)(1).trim
for replacing if you want to retain previous centent then do str2.Replace(“Desc”,Envitonment.Newline() + str + Envitonment.Newline() + Desc)
cheers
Gokul001
(Gokul Balaji)
November 9, 2022, 3:01pm
8
Great @Kuro
For that Can you please create the another topic. Kindly close this topic by mark as solved. It will help for other user too.
Forum FAQ - How to mark a post as a solution
This document is part of our beginners guide .
This article will teach you how to properly mark a post as a solution.
We were closely following our last UiPath Forum feedback round! topic and carefully extracted all the bits of feedback that was provided. As such, we would like to tackle the topic of solutions on our Forum and how to properly use them.
When is the topic resolved?
The topic can be considered resolved when the topic author has fo…
Gokul001
(Gokul Balaji)
November 9, 2022, 3:04pm
9
For this @Kuro
Simple use like this : "Ser"+vbNewLine+YourString+vbNewLine+"Desc"
Regards
Gokul
system
(system)
Closed
November 12, 2022, 3:04pm
10
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.