brianspilner01 / media-server-scripts

84 stars 18 forks source link

How to match without spaces? #17

Open megapearl opened 2 years ago

megapearl commented 2 years ago

First of all I want to say thanks for your great script.

How to adjust regex to not match [spammydomain .net] but match [spammydomain.net] ? In the dutch language the word 'net' is often used in sentences.

I tried to remove the '?' in "http|. ?(co|pl|link|org|net|mp4|mkv|avi|pdf)([^a-z]|$)" at line 29 of sub-clean.sh but that didn't work out.

sub-clean.sh succesfully processed /mnt/storage/Movies/The Suicide Squad (2021)/The Suicide Squad (2021) Bluray-1080p Nb8.nl.srt
The following lines were removed:
32
00:03:55,951 --> 00:04:01,123
Ik wed om 20 dollar dat hij eraan gaat.
- Ik ook. Net als Weasel, Boomer en Mongal.

sub-clean.sh succesfully processed /mnt/storage/Movies/X-Men Apocalypse (2016)/X-Men Apocalypse (2016) Bluray-1080p Radarr.nl.srt
The following lines were removed:
521
01:06:36,452 --> 01:06:43,182
Anders moeten ze voor altijd hier wonen.
- Je klinkt net als hij. Net als Erik.

sub-clean.sh succesfully processed /mnt/storage/Movies/Walk the Line (2005)/Walk the Line (2005).nl.srt
The following lines were removed:
55
00:10:39,179 --> 00:10:45,059
Niks is het waard. Net als jij.
-Hij heeft het niet gedaan.

sub-clean.sh succesfully processed /mnt/storage/Movies/We Are What We Are (2013)/We Are What We Are (2013).nl.srt
The following lines were removed:
125
00:26:36,429 --> 00:26:40,890
Het is niet eerlijk. Net zoals de rest.

sub-clean.sh succesfully processed /mnt/storage/Movies/Legend (1985)/Legend (1985).nl.srt
The following lines were removed:
155
00:22:22,788 --> 00:22:25,757
Het was lieflijk.... net als een droom.

sub-clean.sh succesfully processed /mnt/storage/Movies/Age of Uprising The Legend of Michael Kohlhaas (2013)/Age of Uprising The Legend of Michael Kohlhaas (2013).nl.srt
The following lines were removed:
163
00:49:41,889 --> 00:49:44,060
Een enkele keer. Net als iedereen.

sub-clean.sh succesfully processed /mnt/storage/Movies/Blade (1998)/Blade (1998).nl.srt
The following lines were removed:
592
01:39:32,820 --> 01:39:35,990
Je gaat eraan. Net als wij allemaal.

sub-clean.sh succesfully processed /mnt/storage/Movies/Aviator, The (2004)/The Aviator.nl.srt
The following lines were removed:
243
00:28:18,613 --> 00:28:22,616
Afmaken is alles. Net aIs in het Ieven.
Vind je ook niet?

Thanks in advance,

Regards, Donald.

keldian commented 2 years ago

|\.( ?(co|pl|link|org|mp4|mkv|avi|pdf)|net)([^a-z]|$)| should do what you're asking.

keldian commented 2 years ago

While I'm at it, for English sub users I'd recommend changing that to |\.( ?(co|pl|org|mp4|mkv|avi|pdf)|(link|net))([^a-z]|$)|. It's rare, but entirely possible for an English sentence to start with "net" or "link" following a period.

megapearl commented 2 years ago

Thank you for sharing!