I encountered one problem when extracted string from text file.
eg: string = “Oct 22 2017 18:24:31: src inside:192.168.48.223/33991 dst outside:10.176.40.5/53 by access-group”
I want to extract substring ‘192.168.48.223/33991’ and ‘10.176.40.5/53’ from string.
how to do ?
Thanks a lot.
You can certainly achieve this via String manipulation.
I’ve attached a rough example for achieve this.
SubStringExample.xaml (8.8 KB)
With that said, it may be more interesting to achieve this via Regex:
RegexExample.xaml (6.6 KB)
Use This Regex Code in your Flow
and store in
Array(0) is Date and Time
Array(1) is Inside Value
Array(2) is Outside Value
I hope this run Perfectly, Once you would change the order of the data…
Instead of this statement You also Use the below Expression
It return Only inside and Outside value that can be stored in an Array
Note \/ This Not a Alphabet its a Symbol \ and /
Thanks a lot :grinning::grinning:
Iam relatively New to UIPath.I have a scenario here.from one of the web pages Iam retrieving a invoice number .For example MS789695.
Now I want only 789695 out of it.But the length of the number is not fixed always,But one thing is always I have to remove first 2 characters out of the extracted one.
Thanks for your support.
Check this workflow, yo may get some idea.
ExtractStringForNumbers.xaml (5.6 KB)
Thanks Sarathi,Actually I used substring as the value iam extracting is dynamic.Iam using substring(2,6).But iam not getting the proper results.correct me
Try like this,
I have used generic data type, so I have converted my strInput to string before us substring.
Iam using get text activity.In one browser iam getiing the correct value like cm12345 but when iam using the same function in another browser iam getting the result like \n\n\n\ncm12345\n\n.
why like this and how to write substring function.
Use the following statement and regex to remove \n - the new line character from your string, then go for substring as discussed earlier.
Regex.Replace(strInput, “\t|\n|\r”, “”)
I need ur help in getting this resolved.Iam extracting a text from web page.Iam getting text like this .
\n\n\nName:JDavey Age:30 City:Newyork.
But I want the Output only JDavey , Here Name length may vary dynamically,But always present between Name: and Age:
The below should work:
Assign - strSomeString = \n\n\nName:JDavey Age:30 City:Newyork.
Assign - strSomeString = strSomeString.Substring((strSomeString.IndexOf("Name:") + 5), strSomeString.IndexOf("Age:") - (strSomeString.IndexOf("Name:") + 5))
Log - strSomeString
Should function in any situation, as long as the structure remains the same.
As in, “Name:” and “Age:” are always in the same position.
Thanks in advance,
But if the length of the name changes from JDAVEY to JOSHDavey.
Thanks a lot Josh. I got it.