transform illegal repetition {

Hi,

I’m trying to remove the braces from a json response to save it in session.

The json property i want to extract is this one :

"caseFolderId" : "{633F78F2-6CD1-481D-BA86-8DE74071648E}",

So i’m doing this :

.check(jsonPath("$.caseFolderId").ofType[String].transform( string => string.replaceAll("{", "")).saveAs("caseIdentifier"))

and i got this error :

jsonPath($.caseFolderId) transform.exists failed, could not extract: transform crashed: Illegal repetition {

Any idea ?

http://stackoverflow.com/questions/8751482/patternsyntaxexception-illegal-repetition-when-using-regex-in-java

But then, wouldn’t a simple substing do the trick?

Hi David,

In a regex, ‘{’ means how much you want to repeat the previous pattern, such as “a{1, 2}” for any encounter of “a” and “aa”.

You need to escape the brace like this : “\{”. (You do need the two of thems)

Cheers.

Hi,

Yeah substring would probably do the trick.

My bad for the regex, shame on me.

Thanks guys.

Omg, my bad sorry for this one. (regex… :frowning: )

And yes substring would certainly be another way to do it.

Thanks guys,