FAB
(Fabian Altendorfer)
March 17, 2022, 9:29am
1
Hello all,
i have a problem concerning a special character in a field I scrape from a webpage.
The field looks like that:
I only want the number, so I replace the other characters:
Unfortunately, I cant assign the processed number to an INT32-Field, because the process says that it
s in the wrong format. After copying the error message in a word, I saw that there is a special character in between:
I want to replace the °, but if I copy the sign from word into my process, I only get an empty space. Also if I want to replace the ° with the character on my keyboard it doesn`t work.
Any suggestions? Im grateful for your help!
Cheers, Fabian
Gokul001
(Gokul Balaji)
March 17, 2022, 9:35am
3
Hi @FAB
Can you share the Input and output string
You can achieve via Regex expression
System.Text.RegularExpressions.Regex.Replace(Inputstring, “[^\w\-]”, “”).ToString
Regards
Gokul
1 Like
ppr
(Peter Preuss)
March 17, 2022, 9:38am
4
About the kilometers… also have a look on Regex like
then you can post process the string further
1 Like
FAB
(Fabian Altendorfer)
March 17, 2022, 9:38am
5
Thx, but doesn`t work. I also used the # to see if it puts it in my number, unfortunately the result is still the same as before.
ppr
(Peter Preuss)
March 17, 2022, 9:44am
6
FAB:
Thx, but doesn`t work.
as also shown in the screenshot was the usage of ASC method.
We can use this method, when passing the particular unknown char to it by using the position index of it within the string.
However we would recommend
start analysis on the webpage and check for any entities
check the result when grabbed from there
do analysis as mentioned above
avoid too much corrections in one go
Currently we also cannot match 87°097 screenshot to your reported 182 800 km case. Maybe you can elaborate on it
1 Like
FAB
(Fabian Altendorfer)
March 17, 2022, 12:01pm
7
You are right Peter, thank you for your help! I will have a look on your suggestions!
FAB
(Fabian Altendorfer)
March 17, 2022, 12:11pm
8
Unfortunately the REGEX Expression doesn`t help. My Expression in the Assign activity KilometersRegex:
System.Text.RegularExpressions.Regex.Replace(KilometersReady, “[^\w\-]”, “”).ToString
The input from “KilometersReady” :
“message”: “87 097 km”,
“level”: “Trace”,
“logType”: “User”,
The output after Kilometers Regex:
“message”: “87 097 km”,
“level”: “Trace”,
“logType”: “User”
Gokul001
(Gokul Balaji)
March 17, 2022, 1:02pm
9
Can you share the Input and Output @FAB
ppr
(Peter Preuss)
March 17, 2022, 4:27pm
10
better input output samples would help us. Also have a look on this
last line is about to extract a block as short as possible and extract from this only the digits
1 Like
ushu
(Usha kiranmai)
March 17, 2022, 6:01pm
11
@FAB We can ignore these type of characters and get only numbers separated by it and finally concat the entire value
This way in future if you get any character other than this, that can be simply handled with the above logic
Please find the workflow attached
Regex.zip (2.3 KB)
1 Like
system
(system)
Closed
March 28, 2022, 6:48am
12
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.