Page 1 of 1

please hepl about a regex code

Posted: 05 Sep 2024 10:49
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

Re: please hepl about a regex code

Posted: 05 Sep 2024 14:10
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* ...