Regex word extraction

Hello All,

I want to extract CN123456 word from below sentence.
Request for Quote : CN123456 (ABC COMPANY LIMITED)
Help me to achieve this.

Thanks in advance

Hi @RAMESH_G

Please try the below expression!

[A-Z]{2}\d{6}
system.Text.RegularExpressions.Regex.Match(str_input,"[A-Z]{2}\d{6}").ToString

Where str_input is the inputstring.

Regards

Hello @RAMESH_G

Below is the Regular Expression which can extract the string you are requesting for

(?<=:\s).+(?=\s()

Output:-

Mark as solution and like it if this helps you :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

Hi @RAMESH_G,

Is the same pattern always? If the are any variations of the sentence from which you want to extract the text it would be good to post them here so that we would be able to provide the most reliable solution :wink:

Regards,
Kamil

Thank you so much your help

Hi @kmisko11,

input format is same but value will be different.
E.g,
1.Request for Quote : CN123456 (ABC COMPANY LIMITED)
2.Request for Quote : CN456789-1 (BCD COMPANY LIMITED)
3.Request for Quote : CN345678-1 (XYZ COMPANY LIMITED)

Please help me in these cases.

Thank you

Thank you so much :smile:

Hi @RAMESH_G

what would be required output?

Is the above as first post or different!

Regards

Hi @pravin_calvin ,

Output , i need as for each match cases
I want to extract CN… number.
Like below.

  1. CN123456
  2. CN456789-1
  3. CN345678-1

Hello @RAMESH_G

Look at the below screenshot …!!

Is it the same you are loooking for?

regex101: build, test, and debug regex

(?<=:\s).+(?=\s()

Mark as solution and like it if this helps you :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

Thanks @Pratik_Wavhal
Thanks @pravin_calvin
Thanks @kmisko11

It helped me.

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