please hepl about a regex code

Discuss and share scripts and script files...
Post Reply
drjs5x
Posts: 153
Joined: 18 Nov 2015 18:12
Location: Turkey

please hepl about a regex code

Post by drjs5x »

hi dear coders
can u help me a code.

c:\\mymovies\Superman1080p.part1.rar,c:\\mymovies\Superman1080p.part1.rar,c:\\mymovies\Superman480p.part1.rar,c:\\mymovies\Superman480p.part1.rar,c:\\mymovies\Superman480p.part1.rar,c:\\mymovies\Superman480p.part1.rar,


how can only select 1080p files paths with Regex Pattern.

(?=c:)(.*?)(?=,)
i used this patten . but i cant filter 1080p only.

3 condition
1) start with c:
2) 1080p word content
3) end with ,

im not good at regex
pls hepl
Sincerely
newbie or not...........

highend
Posts: 13647
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: please hepl about a regex code

Post by highend »

?
Apart from that a local path has no double backslashes, all file names are the same and that one should never separate them via a comma...

Code: Select all

$str = "c:\\mymovies\Superman1080p.part1.rar,c:\\mymovies\Superman1080p.part1.rar,c:\\mymovies\Superman480p.part1.rar,c:\\mymovies\Superman480p.part1.rar,c:\\mymovies\Superman480p.part1.rar,c:\\mymovies\Superman480p.part1.rar,";
    text regexmatches($str, "c:(.*?)1080p(.*?),", <crlf>);
The same could be done without using a regex at all, just by using formatlist() with a filter for *1080p* ...
One of my scripts helped you out? Please donate via Paypal

Post Reply