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 = …
fewi
January 28, 2011, 4:38am
3
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
mrz
January 28, 2011, 6:52am
5
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”.
mrz
January 28, 2011, 7:27am
7
:foreach i in=[/ppp active find] do={
:local uname [/ppp active get $i name];
:if ( [:pick $uname 0 3] = “cn-”) do={ :put $uname}
}