regexkeyboard-maestro

Formatting regular expression output (for Keyboard maestro).


I have a keyboard macro tool (keyboard maestro) that returns current date in %NumberDate% variable; it contains a string "3/31/15" for March 31, 2015.

The tool supports regular expression, so using the regular expression, I need to transform this value into formatted string of [yyyy/MM/dd] format; in this example [2015/03/31].

The expression that I used to extract the information is (\d+)/(\d+)/(\d+), however, [20$3/$1/$2] makes [2015/3/31] not [2015/03/31]. Is there any way to check if $1 or $2 is one digit to insert 0 automatically?

enter image description here


Solution

  • enter image description here

    I could use ICUDateTimeFor to get and replace the date format.

    %ICUDateTimeFor%NOW()+20%[yyyy/MM/dd]%