Hello All,
I’m having a text file which contains some lines inside which a URL is present. I need to get the URL alone.
Please find the below file content (Example).
**New ABCD document. **
A new ABCD is required. Work ID: 132465789 for ABC PAN: 8974526 is in the “Approved” status.
**View Item https://www.abcd.com/source/634566316556|Unknown|TWFpbGZefvv0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJvsdvddfsdfjoiTWFpbCIsIldUIjoyfQ%3D%3D|0|||&sdata=l1Wfdf84d7hkz%2Bj%2Fht7czDYkoq8j4SMdfsQmwVczKc%3D&reserved=0 **
This message has been sent by BOT
From this content, I need to extract the URL alone. (i.e.) The output should be as below.
https://www.abcd.com/source/634566316556|Unknown|TWFpbGZefvv0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJvsdvddfsdfjoiTWFpbCIsIldUIjoyfQ%3D%3D|0|||&sdata=l1Wfdf84d7hkz%2Bj%2Fht7czDYkoq8j4SMdfsQmwVczKc%3D&reserved=0
Requesting for your help here please.
Thank you..
adi.mehare
(Aditya Mehare)
2
Use regex to extract URL from the above text.
Regex Format : https://\S+
Let me know if you need more help.
1 Like
@aqeel.ngl,
You can get it like this:
matches = System.Text.RegularExpressions.Regex.Matches(inputFromTextFile, "https?[^\s]+")
Variable - matches
Datatype - System.Text.RegularExpressions.MatchCollection
Using **For Each ** Activity you can loop through each link.
1 Like
Thank you @adi.mehare This helped.
1 Like
system
(system)
Closed
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.