How to take this Value from string using regex

InputString=“ABC
JANUARY 13,2023
DEF” i Need that JANUARY 13,2023 String Value. Suggest a method to get it

Hi @Gopi_Krishna1

Try this

image

Regards,

@Gopi_Krishna1

image

OutputString=System.Text.RegularExpressions.Regex.Match(InputString,"[A-Z]+\s+\d{2}\,\d{4}").Value

Instead ABC and DEF if any other comes means what is the expression

@Gopi_Krishna1

It works

System.Text.RegularExpressions.Regex.Match(str,"[A-Z]+\s+\d+\,\d+").Value

@Gopi_Krishna1

image

@Gopi_Krishna1

Regular expression checks the pattern if it matches the pattern then it will store that data,
For example:[A-Z]+\s+\d{2}\,\d{4}

In this it will check the word or one letter which contains space and then digits of length 2and then comma and then digit with length of 4 then only it stores the data.

Hope it gives some basic understanding

1 Like

Hi @Gopi_Krishna1

Assign-> Input = "ABC
JANUARY 13,2023
DEF"

Assign-> Output = System.Text.RegularExpressions.Regex.Match(Input,"\w+.*\d+").Value.Trim()

Hope it helps!!

1 Like

Below workflow will give you better understanding:

Regards

1 Like

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