03-22-2010 06:25 AM
HI, I'm trying to implement a commit script which checks the format of an IP address. I know that JUNOS configuration commands support the use of regular expressions; is it possible to use regular expressions also in commit and operational scripts?
Thanks in advance for your help,
Mattia
Solved! Go to Solution.
03-22-2010 03:43 PM
You can use many of the standard unix-style regex expression in Junos automation scripts (commit/op/event). Please take a look here for more detail:
There is also a parse-ip() extension function available for parsing IP address:
Here's an example script which makes use of parse-ip():
http://www.juniper.net/us/en/community/junos/scrip
Hope it helps.
03-23-2010 02:49 AM
Hi Roy, thanks for your feedback! I wasn't able to figure out the correct syntax to use (the matches statement seems to be supported only by configuration commands).
Looking into the links you suggested I found the jcs:regex() function, that's exaclty what I need!