Home > Enterprise >  Regex expression for season/episode combinations
Regex expression for season/episode combinations

Time:08-05

I have a quick question: I need a regular expression in Javascript that given a sentence like Next Episode S2 E24 will ignore the Next Episode segment and give me the S2 E24 segment (of course this should work for all season/episode combinations)

Also, a regex for a sentence like Watch S3 E1 with Premium where it extracts the S3 E1 segment (also allowing for different season/episode combinations).

Thank you.

CodePudding user response:

This can easily be done with S\d E\d

You can test it here: https://regex101.com/r/Z8I4fK/1

It checks for the letter S, then at least 1 digit, then a space, then the letter E, then at least 1 digit

  • Related