Hi guys,
I’m asking first time here for solution please help me.
created the seq for scrapping the recipe’s ingredients. for this, I used the get full text activity but in output showing the lots of blank space between the ingredients.
please help me…
lrtetala
(Lakshman Reddy)
August 8, 2024, 3:25pm
2
Hi @pratiksha_gulhane
Try this
filteredText = String.Join(Environment.NewLine, inputText.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries))
Or
filteredText = System.Text.RegularExpressions.Regex.Replace(inputText, "\s+", " ").Trim()
Regards,
ppr
(Peter Preuss)
August 8, 2024, 3:26pm
3
just share with us some sample input e.g. use quickly the immediate panel and type in your variablename
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum
we would like to inspect as we have to replace multiple line breaks or multiple spaces …
postwick
(Paul Ostwick)
August 8, 2024, 3:38pm
4
Get Full Text is a classic activity. You should be working in modern.
Anyway, Get Text is probably not the best way to do this. Have you tried Table Extraction? For Each UI Element?
singh_sumit
(Sumit Singh Tariyal)
August 9, 2024, 7:09am
5
Hie @pratiksha_gulhane for scrapping the data you can use table extraction activity… any way btw. if your string value has blank space you can use Replace manipulation …
example - create a string variable -
str - input(your get text output).replace(" “,”")
cheers Happy Automation
I am not using the table extraction here. using the get full-text classic activity and dynamic selector.
I used the replace manipulation here but it still has no change.
lrtetala
(Lakshman Reddy)
August 10, 2024, 3:04pm
8
@pratiksha_gulhane
Can you please provide input and expected output
Regards,
yeah, sure. I can share the current output ss here.
A message box displaying a list of 12 ingredients for a recipe, including Granny Smith apples, caster sugar, ground cinnamon, morello cherries, cornflour, butter, plain flour, brown sugar, rolled oats, and shredded coconut. (Captioned by AI) 885×1072 13.6 KB
lrtetala
(Lakshman Reddy)
August 10, 2024, 3:18pm
10
@pratiksha_gulhane
Try this
Input.ReplaceLineEndings(“”)
Regards,
1 Like
ppr
(Peter Preuss)
August 10, 2024, 3:20pm
11
Give a try at
Assign activity:
strCleansed =
System.Text.RegularExpressions.Regex.Replace(yourTextVar, "[\r\n]+", Environment.NewlIne)
you can prototypw within the immediate panel
After that we can trim the multiple spaces by
strCleansed2 =
System.Text.RegularExpressions.Regex.Replace(strCleansed, "\ +", " ")
thank you. this code is working…
lrtetala
(Lakshman Reddy)
August 10, 2024, 3:48pm
13
@pratiksha_gulhane
Try this
System.Text.RegularExpressions.Regex.Replace(Input, "\s+", Environment.NewLine)
Regards,
ppr
(Peter Preuss)
August 10, 2024, 10:44pm
14
we stressed the scenario with
multiple spaces
multiple linebreaks
multiple linebreaks, spaces and tabs mixed:
and came up to this first cleansing pattern
Done in UiPath:
strText = System.Text.RegularExpressions.Regex.Replace(strText,"(\r?\n\s+)", Environment.NewLine)
For a cleansing on multiple spaces we can do afterwards
strText = System.Text.RegularExpressions.Regex.Replace(strText,"(\ +)", " ")
When text comes from web extractions then maybe we would also cleanse all non-breakable spaces ( chr(160) ) in advance
thanks for code @ppr
solution -
strText = System.Text.RegularExpressions.Regex.Replace(strText,“(\r?\n\s+)”, Environment.NewLine)
system
(system)
Closed
August 14, 2024, 3:13pm
17
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.