regexnintex-workflow

RegEx to extract Date from time


I have the following date & time and looking to convert it to a simple digit using RegEx

What I have: 2017-11-02T04:00:00Z

What I want to convert it to: 20171102 (including leading zeros of months/dates)

Is this possible with RegEx? Was able to only get '2017-' after hours of work using '^(.*?)-'

Seems harder and harder, any helping hand is much appreciated

Edit: Showing where I am trying this. I am trying to do this on Nintex for SharePoint. But prior to that, I am using www.regEx101.com to validate

enter image description here

enter image description here


Solution

  • Use the following regex with the Replace template:

    ^(\d{4})-(\d{2})-(\d{2}).*
    

    and provide

    $1$2$3
    

    as the replacement pattern.

    Details

    See the regex demo.

    enter image description here