Welcome, Guest. Please login or register.

Login with username, password and session length

Advanced search

10 843 Posts in 6 218 Topics- by 1 216 Members - Latest Member: santini862

4 June 2020, 11:29
Select Language English | Russian ru | German
Main PageIRC Client KVIrc forumKVIrc discussionKVIrc scriptingHelp with Parsing A File Name
Pages: [1]
Author Topic: Help with Parsing A File Name  (Read 2281 times)
0 Members and 1 Guest are viewing this topic.

Репутация: 0
Posts: 1

View Profile
« on: 16 May 2016, 21:34 »

Most of my video files are names "fileName.S##E##.*.mkv". I found this grep command

%stuff = $str.grep("^(.*)[^a-zA-Z0-9]S[0-9]+[^a-zA-Z0-9]?E[0-9]+[^a-zA-Z0-9]",%testName,"rp")

that will extract the fileName part to %stuff[1], but I'm looking to also get the season and episode numbers. Currently I use the index location in the zeroth array like:

%season = $str.mid(%testName,$(%stuff[0]-6),2)
%episode = $str.mid(%testName,$(%stuff[0]-3),2)

According to https://github.com/kvirc/KVIrc/issues/1404 the "p" flag is depreciated. Is there a better way to get this information especially when I'm ls and have a folder full of file names?
« Last Edit: 16 May 2016, 21:54 by tevi » Logged
Pages: [1]
Jump to:  

Theme orange-lt created by panic