Regex extracting the string

Hi,
I want to extract a a particular string
example
this is a notbook : with or new bokk. orchrestator
extracted string = with
System.Text.RegularExpressions.Regex.Match( StrTextData,“:(.*)or”).ToString
the output i am getting is : with or new bokk.

@Krutika_Kotkar

Can you please be more clear??

Please give us 1-2 examples which shows (input string) and output string using the regex.
I shall create a workflow accordingly and share with you.

Thanks and Regards,
@hacky

what you want to extract

> this is a notbook : with or new bokk. orchrestator from this you want with as output ?

yes i want with as output

lic.no. 2ABC743 or some worhds rjhrf or moredate
i need on 2ABC743

but you need to find a patron between what you extract

2ABC743 and With are not even similar

i gave few more examples
ex 1 : lic.no. 2ABC743 or some worhds rjhrf or moredate
i need on 2ABC743
ex 2 : this is a notbook : with or new bokk. orchrestator
i need with

@Krutika_Kotkar

From what I understand, two examples are:-

  1. input: lic.no. 2ABC743 or some worhds rjhrf or moredate
    output: 2ABC743

  2. input: this is a notbook : with or new bokk. orchrestator
    output: with

Please confirm if I got it right.

Also, for using a regex, we need to have standard string pattern, I guess better examples could help us more.

Regards,
@hacky

only you have these two formats or any other ? bcz above two examples are different so we have make two regex

Exactly, that’s what I meant. You need to find a pattern in common or you wont get the same output always (it won’t even work)

okay so there will be a string
in that
string is
Lic.No. somevalues or S/code & A/c No. somevalues Matchcode somevalues other label: somevalues Orig Exp. Date: somevalues

the pattern is fixed
i need value of licno
i hope this makes sense now

Hi @Krutika_Kotkar,

Are you looking to extract only the value of Lic. No. while the pattern is fixed, i.e., the value will be between the texts Lic.No. and or?

Thanks & Regards,
Apurba

Hi @Krutika_Kotkar

Use this pattern

[0-9][A-Z].*

Thanks
Ashwin.S

Yes @apurba2samanta

This regex pattern will help, lic.no.(.*?)or

Hi @Krutika_Kotkar

From what I read assign the following text to a variable and you should get output.

System.Text.RegularExpressions.Regex.Match("Lic.No. somevalues or S/code	& A/c No. somevalues Matchcode somevalues other label: somevalues Orig Exp. Date: somevalues", "(?<=Lic\.No\. )(.*?)(?=\s)").Value.Trim

This part of regex is explained in the link

Cheers

Hi @Krutika_Kotkar,

Please try with the below -
Regex.Match(Your_String_Variable,“(?<=Lic\s*.\sNo.|NO.\s)(.)(?=\sor)”).Value.Trim

Hope this will help you.

Thanks & Regards,
Apurba

how can i extract with regex-match a string? (the result of the wizard)?