Question

37
Views
Close popover
Adam Shawcross (AdamS229)
TalkTalk

TalkTalk
GB
AdamS229 Member since 2019 3 posts
TalkTalk
Posted: October 1, 2020
Last activity: October 1, 2020

RegEx Escape Characters and \d Issue

^\d$

In theory, would just check for one digit and pass. However, on Save Pega returns the error:

  • Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ )

This can be fixed by placing a second \ infront of the d, and it will save and work as intended checking for a single digit. 

^\\d$

 

However,  interestingly, only the first version of the regex  works on Pega's RegEx Tester, negating the usefulness of that activity as in essence it's returned a false positive. 

 

I was wondering if anyone could explain, why this fail to save occurs and what other situations it would occur in?

 

Also, if anyone has any other RegEx related errors I'd be interested to hear.

Pega Platform 8.3.1 User Experience