RegularRegExpressionsEx101
Show Sidebar
Library entries
0
0 upvotes, 0 downvotes (NaN% like it) (You must be signed in to vote)
pcre
Submitted by anonymous - 6 hours ago
replace variable with accessor
no description available
0
0 upvotes, 0 downvotes (NaN% like it) (You must be signed in to vote)
golang
Submitted by anonymous - 9 hours ago
Lxx Wurzel
no description available
0
0 upvotes, 0 downvotes (NaN% like it) (You must be signed in to vote)
pcre
Submitted by anonymous - a day ago
stardust pdp uk en us
no description available
0
0 upvotes, 0 downvotes (NaN% like it) (You must be signed in to vote)
pcre
Submitted by anonymous - a day ago
Stardust: NL DE US GB ES promo page
no description available
0
0 upvotes, 0 downvotes (NaN% like it) (You must be signed in to vote)
pcre
Submitted by anonymous - a day ago
Ghasedak RECEIVE SMS Packet HTTP
no description available
0
0 upvotes, 0 downvotes (NaN% like it) (You must be signed in to vote)
python
Submitted by anonymous - a day ago
ffmppeg
no description available
0
0 upvotes, 0 downvotes (NaN% like it) (You must be signed in to vote)
pcre
Submitted by anonymous - a day ago
UserConfiguration.xml
no description available
0
0 upvotes, 0 downvotes (NaN% like it) (You must be signed in to vote)
pcre
Submitted by anonymous - 2 days ago
US Cellphone Match
no description available
0
0 upvotes, 0 downvotes (NaN% like it) (You must be signed in to vote)
pcre
Submitted by anonymous - 2 days ago
consnum
Partner2 access log Nginx
1
1 upvotes, 0 downvotes (100% like it) (You must be signed in to vote)
pcre
Submitted by anonymous - 2 days ago
need to ask partial
no description available
0
0 upvotes, 0 downvotes (NaN% like it) (You must be signed in to vote)
javascript
Submitted by anonymous - 2 days ago
Export WP
no description available
1
1 upvotes, 0 downvotes (100% like it) (You must be signed in to vote)
pcre
Submitted by anonymous - 3 days ago
Resolvers
APD SFs too general
0
0 upvotes, 0 downvotes (NaN% like it) (You must be signed in to vote)
pcre
Submitted by anonymous - 3 days ago
Carfax job name
no description available
Library Entry
Close
Distinguish torrent files (series vs movies)
python
"
^ # get the title of this movie or series (?P<title> [-\w'"]+ # match separator to later replace into correct title (?P<separator> [ .] ) # note this *must* be lazy for the engine to work ltr not rtl (?: [-\w'"]+\2 )*? ) # start of movie vs serie check (?: # if this is an episode, lets match the season # number one way or another. if not, the year # of the movie (?: # series. can be a lot prettier if we used perl regex... # make sure this is not just a number in the title followed by our separator. # like, iron man 3 2013 or my.fictional.24.series (?! \d+ \2 ) # now try to match the season number (?: s (?: eason \2? )? )? (?P<season> \d\d? ) # needed to validate the last token is a dot, or whatever. (?: e\d\d? (?:-e?\d\d?)? | x\d\d? )? | # this is likely a movie, match the year (?P<year> [(\]]?\d{4}[)\]]? ) ) # make sure this ends with the separator, otherwise we # might be in the middle of something like "1080p" (?=\2) | # if we get here, this is likely still a movie. # match until one of the keywords (?= BOXSET | XVID | DIVX | LIMITED | UNRATED | PROPER | DTS | AC3 | AAC | BLU[ -]?RAY | HD(?:TV|DVD) | (?:DVD|B[DR]|WEB)RIP | \d+p | [hx]\.?264 ) )
"
gimx
Description

A neat regex for finding out whether a given torrent name is a series or a movie.

Returns the full name of the series with the separator needed to make it pretty (ie, replace it with space or what you want). Also returns the season number or the year for the movie/series, depending on what was previously matches.

If I had done this in perl there would be much less logic needed in the regex, but python is what I'm working with so..

Submitted by Firas Dib - 6 years ago
Discussion