Martin T
2018-06-14 21:39:30 UTC
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?
thanks,
Martin
_______________________________________________
juniper-nsp mailing list juniper-***@puck.nether.net
https://puck.nether.net/mailman/listinfo/juniper-nsp
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?
thanks,
Martin
_______________________________________________
juniper-nsp mailing list juniper-***@puck.nether.net
https://puck.nether.net/mailman/listinfo/juniper-nsp