Is it possible to use a regex in karate if condition as below
eval if ( xx!=“#regex [0-9]{7}”) karate.log(“success”)
I wanted to execute a if statement, regex evaluation is passed . Above code doesn’t evaluate as regex . It simply prints the log
Is it possible to use a regex in karate if condition as below
eval if ( xx!=“#regex [0-9]{7}”) karate.log(“success”)
I wanted to execute a if statement, regex evaluation is passed . Above code doesn’t evaluate as regex . It simply prints the log
You can use karate.match():
* def test = '123'
* if (karate.match(test, '#regex [0-9]+').pass) karate.log('pass')
Please refer to the docs: https://github.com/intuit/karate#karate-match