#1
|
|||
|
|||
REGEX for file extension in Archive Extractor
Hi, attempting to create a REGEX to extract only PDFs
For my test I have a RAR with these files: Quote:
Quote:
.*\.(?!pdf) - matched both .*[.](?!pdf) - matched both .*(?!pdf)$ - matched none ^.*(?!pdf)$ - matched none I read a message from 2019 that says that JD uses Java patterns, shouldn't it work? forget the line anchors, why does the negative lookahead match both epub and pdf? Tested with regex101.com (Java 8 flavor), works over there, but not in JD. help me fams.. Edit: Also, this REGEX works but come on...that's really ugly, would rather use negative lookaheads.. .*\.[^p][^d][^f].? Last edited by 43535; 03.05.2022 at 15:11. |
#2
|
||||
|
||||
@43535:
You want a regex that filters out everyting except pdf, right? negative look-behind -> everything that has not .pdf before end of line Code:
.*(?<!\.pdf)$
__________________
JD-Dev & Server-Admin |
#3
|
|||
|
|||
Seems like I need to up my REGEX game...
Thanks Jiaz :) |
#4
|
||||
|
||||
After many many years of playing the regex game, I still have to look up the negative/positive look arounds as I use them so rarly and when I have to, I've always forgot how they work
__________________
JD-Dev & Server-Admin |
#5
|
||||
|
||||
I can recommend regex101.com as an online tool to play around with regular expressions
__________________
JD Supporter, Plugin Dev. & Community Manager
Erste Schritte & Tutorials || JDownloader 2 Setup Download |
#6
|
||||
|
||||
@pspzockerscene: He already knows about it
__________________
JD-Dev & Server-Admin |
#7
|
||||
|
||||
__
my bad
__________________
JD Supporter, Plugin Dev. & Community Manager
Erste Schritte & Tutorials || JDownloader 2 Setup Download |
Thread Tools | |
Display Modes | |
|
|