Hi Martin,

There is not() :


https://www.juniper.net/documentation/en_US/junos/topics/reference/scripting/junos-script-automation-function-xslt-not.html



On 14-Jun-18 23:39, Martin T wrote:
Hi!

I have quite often used "!" negation operator familiar from other
languages. For example:

/* If string does not match the pattern, then terminate the script. */
if ( ! jcs:regex( $pattern, $string ) )  {
     terminate 'Invalid input string!';
}

However, I have not found this method in the official SLAX
documentation or SLAX operators list. Based on my example above, the
suggested solution seems to be to check if jcs:regex returned an empty
node-set or not using jcs:empty:

if ( jcs:empty( jcs:regex( $pattern, $string ) ) ) {
     terminate 'Invalid input string!';
}

Just out of curiosity, is there a difference between those two methods?




_______________________________________________
juniper-nsp mailing list juniper-nsp@puck.nether.net
https://puck.nether.net/mailman/listinfo/juniper-nsp

Reply via email to