Open Zae opened 4 years ago
I'm also a bit confused, on a much simpler level.
The README states that you define a glob with !*.example.com
, but in my own testing I have found *.example.com
works just fine. What is the !
for?
The README doesn't mention that matching is incredibly relaxed.
example.com
matches www.example.com
*.example.com
matches example.com
I don't know if that's an undocumented convenience, or a bug.
Yeah I'd also like a better documentation on the rules.
What is the
!
for?
Indicates the type of rules that apply. ! for global rules, @ for regex. There are also simple rules, which as far as I tested don't work at all.
Based on the source code (https://github.com/kintesh/containerise/blob/ec227436341fb761a7bdc51477085779e5c6373b/src/utils.js, starting on line 65), those initial characters tell the code how to interpret the pattern-- whether it is a literal match, a glob (simplified regex), or a regex.
!
activates "globbing", which translates the glob into a simple regex (line 92 in the source):
// 1. becomes . // 2. ? becomes .?
@
activates "regex" (line 85 in the source). The first character (the @
) is stripped, and everything else is passed as a javascript regex. You can test your regex by opening the firefox web console, and doing
RegExp('yourPattern').test('your.url.com');
For example, if your pattern was @^(.+\.)?redd(it\.com|\.it)
(this matches reddit.com
, redd.it
, *.reddit.com
, and *.redd.it
), you could test in your browser console as follows:
RegExp('^(.+\.)?redd(it\.com|\.it)').test('www.reddit.com');
For what it is worth, I have found that including a $
in your regex as shown in many of the examples will generally cause the match to fail.
Hi,
I've tried to get this to work using a path, but somehow I'm failing. I just can't get containerise to open my links in a container I choose.
I want urls that follow this pattern to open in their own container:
https://sub.example.com/browse/service-*
I tried the glob matcher with ! and the regex matcher with @ but the container never opens, I have no idea what i'm doing wrong as there is not feedback from the plugin at all if i'm doing things right and there is no documentation on this.