How to use in regex

User-to-User discussion about the PhraseExpress macro programming.
Post Reply
Nelsao
Posts: 19
Joined: 04 Jan 21, 05:01

How to use in regex

Post by Nelsao » 12 Jun 21, 16:30

How to use in regex,
Hi ! Estroy trying to get Pharase Express to separate the dates that are like this: 2021 06 12 to transform them like this 12 06 2021. For this I use the regex, ([0-9]{4})[ ]([0-9]{1,2})[ ]([0-9]{1,2})

This finds the date, and now you will have to use the delimiter 3 \ 2 \ 1, using "if then else" to wrap or another macro. But I CAN'T find a way to reference the captured expressions. How can groups be grouped and then referenced in Pharase Express?

Technical Support
Posts: 2923
Joined: 10 Feb 06, 22:23

Post by Technical Support » 14 Jun 21, 08:39

This should do it:

Code: Select all

{#regexrep -text 2021 06 12 -expr ([0-9]{4\\\})[ ]([0-9]{1,2\\\})[ ]([0-9]{1,2\\\}) -repexpr \3 \2 \1 -variablename Switch date}

Nelsao
Posts: 19
Joined: 04 Jan 21, 05:01

Post by Nelsao » 18 Jun 21, 04:10

¡ Muchas Gracias ! I love Phraseexpress, I have used it for eight (8) years ♥ ️

Post Reply