ublacklist icon indicating copy to clipboard operation
ublacklist copied to clipboard

Simpler way to match domains?

Open pjmattingly opened this issue 1 year ago • 4 comments

I wanted to match the entire gov domain, but simple constructions like:

*://*.gov/

don't seem to work. Checking through the Advanced Features, I found an example for matching "internationalized domain names":

/^https?:\/\/([^/.]+\.)*?xn--/

Which then could be adapted to block gov:

/^https?:\/\/([^/.]+\.)*?gov/

Is there a simpler way? If so I believe it would be helpful to show it in the help documentation.

pjmattingly avatar Nov 19 '24 20:11 pjmattingly

You could just use regular expressions, like this /.*\.gov/

laylavish avatar Nov 22 '24 20:11 laylavish

You could just use regular expressions, like this /.*\.gov/

I'mma give that a try, see how it works on my setup.

{To anyone} This one probably needs a regex... What would be a 'simple' way to filter (.com|.gov)(.|ai|io|us) , specific combos like

com.us gov,ai gov.us com.eu

realAzazello avatar Nov 24 '24 18:11 realAzazello

@realAzazello probably this: /.*\.(com|gov|ai|io|us)/

laylavish avatar Nov 24 '24 19:11 laylavish

Thanks but not quite it-- I'm looking for filter specifically combos like

com.us gov,ai gov.us com.eu

realAzazello avatar Nov 25 '24 02:11 realAzazello

Thanks but not quite it-- I'm looking for filter specifically combos like

com.us gov,ai gov.us com.eu

I had found a solution for my examples just a few months ago, forgot to share:

# This might not be efficient - but works! /^https?:\/\/([^/.]+\.)*?com\.(ai|eu|ευ|us)\/(.*)/ /^https?:\/\/([^/.]+\.)*?gov\.(ai|eu|ευ|us)\/(.*)/

Don't know if this can be done simpler.

realAzazello avatar Jun 27 '25 17:06 realAzazello

I wanted to match the entire gov domain, but simple constructions like: *://*.gov/ don't seem to work.

*://*.gov/*

Thanks but not quite it-- I'm looking for filter specifically combos like

com.us gov,ai gov.us com.eu

host =~ /\.(com|gov)\.(ai|eu|us)$/

iorate avatar Aug 10 '25 07:08 iorate