Manipulation for extracting Date form string Using Regex

#Useful Code #1 #learn #uipath
Suppose you want to extract date from the sentence , you need only 20 December 2018

InputString =“date scrapping require is 20 December 2018”

1). Create one Variable for example “Result” with data type - Match.
2). Assign Result = new Regex("[0-9]{2}[\s][A-Za-z]+[\s][0-9]{4}").Match(InputString) .
3) In log message , write Result.Value
4). you can check you will get your desire result.
Output will be 20 December 2018

1 Like

Hi @syedabidraza - How can we extract if its 20[th- which is above 0 in small letters] December 2018.


This is also possible,

  1. \d{2}\s+[\w]+\s+\d{4}
  2. If we know that "Date Scrapping require is" is always constant then we can use below one.

(?<=(date scrapping require is)\s)\d{2}\s+[\w]+\s+\d{4}


If the Input string is : date scrapping require is 20th December 2018
Please try this:

hi… i would like to ask if the format of date in the string is for example March 12, 2020? what would be the regex be like for this matter?

You could try this:
(January |February |March |April |May |June |July |August |September |October |November |December )\s(\d*),\s(20\d\d)