[j-nsp] jcs:split() function with errors

ben b benboyd.lists at gmail.com
Fri Jul 22 18:49:50 EDT 2011


On Fri, Jul 22, 2011 at 3:06 PM, Phil Shafer <phil at juniper.net> wrote:

> ben b writes:
> >> i'm try to find out the number of pipes "|" in all of my interface
> >> descriptions, but for some reason the jcs:split() function errors out in
> my
> >> commit script.  Does anyone have any suggestions?
>
> jcs:split() takes a pattern (regex) instead of a simple string.  You'll
> need to escape the "|" to prevent it from being interpreted in the
> regex context.  You escape this using a backslash, but you also need
> to escape the backslash since SLAX interprets this as _it's_ escape
> character as well.  So you'll end up needing:
>
>    var $description_parts = jcs:split("\\|", description);
>
> Thanks,
>  Phil
>

Thanks Phil, that worked.... that would be why my error was regex empty
expression.  :)


More information about the juniper-nsp mailing list