I need to do a simple split of a string.
The string is "That.Awkward.Moment.2014.720p.BluRay.x264.YIFY.srt"
I just need "That.Awkward.Moment.2014.720p.BluRay.x264.YIFY"
without ".srt"
I tried this and is wrong:
print(string.match("That.Awkward.Moment.2014.720p.BluRay.x264.YIFY.srt", '^.-.s'))
How would I do it?
Since regular matching is greedy, you just need to match anything until you see .
(don't forget to escape it):
print(string.match("That.Awkward.Moment.2014.720p.BluRay.x264.YIFY.srt", '(.+)%.(.+)'))
will print
That.Awkward.Moment.2014.720p.BluRay.x264.YIFY srt