Regex Expressions url

Regex to extract the read text only from below ss
image

Hey @Chirag12 , You can use below expressions
(?<=\.).*(?=\.)

image

Hope it helps you out!

It doesnt work for https://forum.uipath.com/ link

@Chirag12

image

Hey @Chirag12 ,
The regex works
Please Refer below screenshot
image

Whats the differnce between yours and @Vikas_M regex

@Chirag12

regex can be done in many ways

can you explain what was the output your are expecting ,if you did not got any solution

cheers

@Vikas_M regex expression works for now, but i wanted to know which one is better

Hi @Chirag12

Use the string manipulation to extract the output from the Input text.

- Assign -> InputStr = "https://en.wikipedia.org/"
- Assign -> Output = InputStr.Split(".")(1).toString.trim

The Output Variable is the output extracted which contains wikipedia

Check the below workflow for better understanding.

You can use the regular expressions too.

System.Text.RegularExpressions.Regex.Matches(yourstringinput.ToString,“((?<=\.)[A-Z a-z]+(?=\.))”)

image

Hope it helps!!

@Chirag12

if there are any other values like spaces or dots or numbers in between it will aslo take that

meaning of .*

cheers

Ohh okay got it
I have something like this also
https://www.web33.co.uk/

@Chirag12

inputstr=“https://www.web33.co.uk/

output=inputstr.Split("."C)(1)

output=web33

cheers

In this case you can use the string manipulation that I have provided above.

- Assign -> InputStr = "https://en.wikipedia.org/"
- Assign -> Output = InputStr.Split(".")(1).toString.trim

and you can use the below regular expression for both websites.

System.Text.RegularExpressions.Regex.Matches(yourstringinput.ToString,“((?<=\/\/\w*\.)[A-Z a-z \d]+(?=\.\w*\.*\w*\/))”)

image

Thank you @Shiva_Nikhil @mkankatala @Vikas_M for helping me

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.