Regular expression match

Hi,

I would like to know how can i do regular expression matching.
I am trying to figure out all active users in “/ppp active print” which starts with “cn-”, like
cn-mudasir
cn-abc
cn-xyz
So how can i only print information about the users having cn- at the begining of the user id.

something like …

/ppp active print where name~“$cn-”

i didnt even test it, but i think the trick is to use ~ instead of = …

Yup, exactly. Only thing to change is that $ means end of the string, so you want to use ^ instead to match at the beginning.

Thanks allot.

I got that working in 4 of my v4.16 ROS, but is there any way to get this working in v3.23. Because I have 2 ROS v3.23 and 4 ROS v4.16.

Please let me know if there is any method in v3.23

There is no regular expression matcher in v3.23. So if you really need it then upgrade or loop through all the users looking for ‘cn’ in users name.

Ok.

I can loop through all users, but can you please guime me how can i check name for “cn”.

:foreach i in=[/ppp active find] do={
:local uname [/ppp active get $i name];
:if ( [:pick $uname 0 3] = “cn-”) do={ :put $uname}
}

Thanks allot.

Got it working..