title: How to write a regular expression utilizing the Robot Framework to find/replace various date strings
body: <p>I have an automated test using the Robot Framework that reads a file into a variable. I'm parsing that variable for various date formats and trying to replace the date with the current date using a regex.</p>
  
  <p>What I am struggling with is getting a regex to work in the Robot Framework (I've written a regex in various websites like pythex and regex101 that appears to work with Python for what I need).</p>
  
  <pre><code>${date}=  get current date
  ${datetime}=  convert date    ${date}  datetime
  ${MonthList}=  create list  January  February  March  April  May  June  July  August  September  October  November  December
  ${monthName}=  get from list  ${MonthList}  ${datetime.month-1}    
  ${ExpectedFileAsString}=  set test variable  January 23, 2009 May 1, 2020 05/21/1990 05/1/1990 5/21/1990 5/2/1990
  
  ${ExpectedFileAsString}=  replace string using regexp  ${ExpectedFileAsString}  ([A-Z][a-z]+\s\d+,\s\d\d\d\d)  ${monthName} ${datetime.day}, ${datetime.year}
  
  ${match1}=  get regexp matches  ${ExpectedFileAsString}  [A-Z][a-z]+\s\d+,\s\d\d\d\d
  log  matches 1: ${match1}  console=yes
  
  ${match2}=  get regexp matches  ${ExpectedFileAsString}  [A-Z][a-z]{2,8}\s\d{1,2},\s\d{4}
  log  matches 2: ${match2}  console=yes
  
  ${ExpectedFileAsString}=  replace string using regexp  ${ExpectedFileAsString}  ([A-Z][a-z]{2,8}\s\d{1,2},\s\d{4})  ${monthName} ${datetime.day}, ${datetime.year}
  
  ${ExpectedFileAsString}=  replace string using regexp  ${ExpectedFileAsString}  (?&lt;![/\d])\d{1,2}/\d{1,2}/\d{4}(?![/\d])  ${datetime.month}/${datetime.day}/${datetime.year}
  </code></pre>
  
  <p>When I use the regex's I provided in my examples against the provided string on the 2 regex websites, they appear to do everything I need. When I run them using the Robot Framework, they get no hits. I must be missing something?</p>