Regex to get value after ":"


I have an expression like
Client ID : A983494
Client Name : John William
Client Country : rome

I want to pick A983494, John William , Rome from this string . What would be the Regex

I made [a-zA-Z0-9_]+$

This picks last word of each line(A983494, William , Rome).

Now I am thing to put OR in this and add logic to pick word after ‘:’ so that it picks through both the logics . What should OR part of regEx Look like?

[[a-zA-Z0-9_]+$| "What should come here "]


1 Like

In your : [a-zA-Z0-9_]+$

you are missing a space identifier \s?

Try: [a-zA-Z0-9_\s?]+$

1 Like

@XYZ_1991 Welcome back to uipath community use regex like this


Welcome back to uipath community
Hope this would help you
(?<=: ).*

A space should come next to : in the expression so that we would get the exact wordings alone
Cheers @XYZ_1991

1 Like

Thank you so much this gave the string but I am in learning phase so have questions :slight_smile:

Hey how would you read this ?
Any character upper,lowe case a-zA-Z0-9
\s? What instruction did this send?

Thank You Indra, This worked but can you explain the combination used

1 Like

\s is the identifier for any whitespace look at this website to learn more regarding webex

Thank You

What does ?<= do ?

1 Like

Hi @XYZ_1991,

Please check with the below. Hope it will help you.
(?<=:\s+)[\w+ ]+

Thanks & Regards,

@XYZ_1991 (?<=:).* Here (?<=:) means it will match starting of the string and .* will match any characters in that line.

That’s a good question
Here ?<=: is an expression that will take all the values to the right side of :
For example if we mention as (?<=!).* In a string like ABCD!efgh, it will give us output as efgh

And if we add .* next to this expression it will take all the characters next to the special symbol !

So does the same in this expression we are using
Simple isn’t it
Cheers @XYZ_1991

Hi @XYZ_1991,

Please use ‘Matches’ activity and use (?<=:\s*).* as pattern. It will give you an array of string, from where you can easily find your required string.

Thanks & Regards,

1 Like

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