Community discussions

MikroTik App
 
User avatar
Vitokhv
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 86
Joined: Mon Aug 19, 2013 4:52 am

Error Terminal command symbol - $

Wed Aug 28, 2019 12:16 pm

v6.45.3
/ip firewall layer7-protocol
add name=drop_website regexp="^.+(gmail).*$"

Image

When entering such a command, field "Regexp" is empty:

Image
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7052
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Error Terminal command symbol - $

Wed Aug 28, 2019 12:54 pm

$ is a special char and must be escaped:
https://wiki.mikrotik.com/wiki/Manual:S ... _Sequences
 
msatter
Forum Guru
Forum Guru
Posts: 2912
Joined: Tue Feb 18, 2014 12:56 am
Location: Netherlands / Nīderlande

Re: Error Terminal command symbol - $

Wed Aug 28, 2019 1:46 pm

Would this be not more efficient?

"\.gmail\..*\$"

You already hooked it up to the end with \$ sign.

It confuses me that Regex is seen as scripting in ROS......
 
User avatar
Vitokhv
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 86
Joined: Mon Aug 19, 2013 4:52 am

Re: Error Terminal command symbol - $

Wed Aug 28, 2019 3:17 pm

I did everything according to the instructions (link), and it seems to me that the command is not the right one:
regexp="^.(youtube.com|youtu.be|netflix.com|vimeo.com|screen.yahoo.com|dailyMotion.com|hulu.com|twitch.tv|liveleak.com|vine.co|break.com|tv.com|metacafe.com|viewster.com).*$"

If I understand you correctly, it should be like this:
regexp="^.(youtube.com|youtu.be|netflix.com|vimeo.com|screen.yahoo.com|dailyMotion.com|hulu.com|twitch.tv|liveleak.com|vine.co|break.com|tv.com|metacafe.com|viewster.com).*\$"

This works, but not sure if parentheses () are needed, and is the $ character needed at the end
 
msatter
Forum Guru
Forum Guru
Posts: 2912
Joined: Tue Feb 18, 2014 12:56 am
Location: Netherlands / Nīderlande

Re: Error Terminal command symbol - $

Wed Aug 28, 2019 4:16 pm

I am using Regex for domain names very often and you have anchor it at the beginning of the domain (^) or at the end ($ (in ROS \$)). If you don't anchor them then it can match any part of the domain name. The group is used for more complex Regex matching and not needed here.

Better, grouping is correct here and it needs a subdomain ("www" is also a subdomain). If you want also to block the main domain (youbube.com) then use (^|\.) at the beginning.

Subdomains and domains:
regexp="(^|\.)(youtube.com|youtu.be|netflix.com|vimeo.com|screen.yahoo.com|dailyMotion.com|hulu.com|twitch.tv|liveleak.com|vine.co|break.com|tv.com|metacafe.com|viewster.com)\$"

Who is online

Users browsing this forum: Bing [Bot] and 41 guests