JDownloader Community - Appwork GmbH
 

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 04.06.2022, 19:45
StefanM's Avatar
StefanM StefanM is offline
JD VIP
 
Join Date: Oct 2020
Posts: 485
Default Question: Using RegEx in Search Bar

From this very old post https://board.jdownloader.org/showpo...78&postcount=4 I learned that there is a setting to enable RegEx in Advanced Settings.

Cannot find such a setting when searching for RegEx.

Is there some kind of auto-detect now?
Reply With Quote
  #2  
Old 05.06.2022, 03:10
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 17,611
Default

in advanced settings > use the filter regex, would end up with 4 results of which the first is your required value, GeneralSettings.filterregex
__________________
raztoki @ jDownloader reporter/developer
http://svn.jdownloader.org/users/170

Don't fight the system, use it to your advantage. :]
Reply With Quote
  #3  
Old 05.06.2022, 12:27
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,289
Default

@StefanM: also see https://board.jdownloader.org/showpo...28&postcount=2
__________________
JD-Dev & Server-Admin
Reply With Quote
  #4  
Old 05.06.2022, 12:55
StefanM's Avatar
StefanM StefanM is offline
JD VIP
 
Join Date: Oct 2020
Posts: 485
Default

Quote:
Originally Posted by raztoki View Post
in advanced settings > use the filter regex, would end up with 4 results of which the first is your required value, GeneralSettings.filterregex
Quote:
Originally Posted by Jiaz View Post
@StefanM: also see **External links are only visible to Support Staff**...
@raztoki, @Jiaz
Thanks to both of you!
And another question for you:
Before I write another request...
I guess that there must be a reason, why wildcards,... are not supported?

If e.g. I want to see videos only, I cannot use
Code:
*.mp4|*.avi|*. ....
Reply With Quote
  #5  
Old 05.06.2022, 13:01
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,289
Default

@StefanM: because that is no valid regex.
Either you use valid regex or use simple mode but without regex support
__________________
JD-Dev & Server-Admin
Reply With Quote
  #6  
Old 05.06.2022, 13:02
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,289
Default

Quote:
Originally Posted by StefanM View Post
why wildcards,... are not supported?
They are!
no regex
Quote:
*
regex
Quote:
.*
__________________
JD-Dev & Server-Admin
Reply With Quote
  #7  
Old 05.06.2022, 13:03
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,289
Default

Quote:
Originally Posted by StefanM View Post
If e.g. I want to see videos only, I cannot use
for example, regex
Quote:
\.(avi|mp4|mkv)$
__________________
JD-Dev & Server-Admin

Last edited by Jiaz; 05.06.2022 at 13:07.
Reply With Quote
  #8  
Old 05.06.2022, 15:38
StefanM's Avatar
StefanM StefanM is offline
JD VIP
 
Join Date: Oct 2020
Posts: 485
Default

Quote:
Originally Posted by Jiaz View Post
@StefanM: because that is no valid regex.
Either you use valid regex or use simple mode but without regex support
Well, then please help me.

In JD I have RegEx not enabled.
Just tested this morning:
Code:
*.txt
and this doesn't give me any results.

However,
Code:
.txt
gives me results: All files that end with or contain .txt

So, my conclusion is the same as in my old documentation:

"Wildcards don't work here"
Reply With Quote
  #9  
Old 05.06.2022, 15:46
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,289
Default

@StefanM: Just tested and wildcard works perfectly fine.
Settings->Advanced Settings->GeneralSettings.filterregex disable
I enter
Quote:
*.mp4
and only files with .mp4 are shown
__________________
JD-Dev & Server-Admin
Reply With Quote
  #10  
Old 05.06.2022, 15:50
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,289
Default

@StefanM: I've tested bottom Searchfield in Downloads/Linkgrabber with and without regex mode, both working perfectly fine

regex disabled:
Quote:
.mp4
*.mp4
working fine

regex enabled:
Quote:
.mp4
.*.mp4
working fine

regex enabled:
Quote:
*.mp4
incorrect, no filtering at all, everything is shown
__________________
JD-Dev & Server-Admin
Reply With Quote
  #11  
Old 05.06.2022, 15:50
StefanM's Avatar
StefanM StefanM is offline
JD VIP
 
Join Date: Oct 2020
Posts: 485
Default

Quote:
Originally Posted by Jiaz View Post
for example, regex
Code:
\.(avi|mp4|mkv)$ 
Yes, I know how RegEx works
What I did not know was, that you can leave the configuration in advanced settings for filterregex disabled and that instead you can type regex: in the search pane to enable it just for one search.

However, can you please tell me which of these delimiters is being accepted by JD? Couldn't find it in my documentation
Must have forgotten to write it down...

Code:
/ ~ @ ; % `#
Reply With Quote
  #12  
Old 05.06.2022, 15:52
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,289
Default

Quote:
Originally Posted by StefanM View Post
However, can you please tell me which of these delimiters is being accepted by JD?
Code:
/ ~ @ ; % `#
I'm sorry but what do you mean? It's normal java Regex/Pattern.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #13  
Old 05.06.2022, 15:56
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,289
Default

@StefanM: In NON Regex mode, there are no delimiters! * is replaced internally by
Quote:
.*
in the pattern, but the rest is quoted, so you cannot use
Quote:
|
in NON Regex mode

But if required, I can add
Quote:
|
support in NON Regex mode
__________________
JD-Dev & Server-Admin
Reply With Quote
  #14  
Old 05.06.2022, 16:00
StefanM's Avatar
StefanM StefanM is offline
JD VIP
 
Join Date: Oct 2020
Posts: 485
Default

Quote:
Originally Posted by Jiaz View Post
@StefanM: I've tested bottom Searchfield in Downloads/Linkgrabber with and without regex mode, both working perfectly fine

regex disabled:

Code:
.mp4
*.mp4
working fine
Then, please have a look at the attachment.
It is not working for me. And I tested more than just one installation :(

Or am I making a mistake here?

Found the bug!

Those two files contain the string .avi somewhere in the middle of the file name.
However, the file name ends with .mp4
*.avi must never match a file that ends with .mp4.

Only *.avi* is matching file names where you find .avi somewhere in the middle of that name.

So, it is not working correctly!
Attached Files
File Type: zip regex_disabled.zip (44.8 KB, 1 views)

Last edited by StefanM; 05.06.2022 at 16:06. Reason: Addendum
Reply With Quote
  #15  
Old 05.06.2022, 16:05
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,289
Default

@StefanM: screenshot doesn't show the full filename
tested and working fine here
Quote:
*.avi
will match any link that contains
Quote:
.avi
anywhere in filename
__________________
JD-Dev & Server-Admin

Last edited by Jiaz; 05.06.2022 at 16:08.
Reply With Quote
  #16  
Old 05.06.2022, 16:09
StefanM's Avatar
StefanM StefanM is offline
JD VIP
 
Join Date: Oct 2020
Posts: 485
Default

Quote:
Originally Posted by Jiaz View Post
@StefanM: screenshot doesn't show the full filename
tested and working fine here
Just a moment....
Reply With Quote
  #17  
Old 05.06.2022, 16:13
StefanM's Avatar
StefanM StefanM is offline
JD VIP
 
Join Date: Oct 2020
Posts: 485
Default

Too bad, that you don't believe me...
But here's the proof you requested.

As I said: *.avi also returns files with .avi somewhere in the middle of the name.
Please test yourself!

You can simply rename any files you have in JD to verify my findings.
Attached Files
File Type: zip full name.zip (40.0 KB, 1 views)

Last edited by StefanM; 05.06.2022 at 16:16.
Reply With Quote
  #18  
Old 05.06.2022, 16:16
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,289
Default

Quote:
Originally Posted by StefanM View Post
Too bad, that you don't believe me...
That's not what I told you. But I've just tested with Downloads/Linkgrabber multiple times and cannot reproduce any issues. Also there has been no changes since ages on this.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #19  
Old 05.06.2022, 16:17
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,289
Default

Quote:
Originally Posted by StefanM View Post
As I said: *.avi also returns files with .avi somewhere in the middle of the name.
Please test yourself!.
Your screenshot is exactly this
https://board.jdownloader.org/showpo...7&postcount=15
That is expected behaviour.

The simple NON regex mode is SIMPLE. It just tries to find your input
and in your case the filename contains
Quote:
.avi
AND
Quote:
*.avi
__________________
JD-Dev & Server-Admin
Reply With Quote
  #20  
Old 05.06.2022, 16:24
StefanM's Avatar
StefanM StefanM is offline
JD VIP
 
Join Date: Oct 2020
Posts: 485
Default

Quote:
Originally Posted by Jiaz View Post
Your screenshot is exactly this
**External links are only visible to Support Staff**...

The simple NON regex mode is SIMPLE. It just tries to find your input
and in your case the filename contains AND
Sorry, I do not agree!
We have a bug here.

When JD accepts wildcards correctly, then e.g. *.txt may only return files that end with .txt. A file such as test.txt.doc may not be returned.

That's the wildcard definition.

But JD also returns test.txt.doc when searching for *.txt
And that is not correct!

I learned this wildcard definition more than 40 years ago
It is still valid - also in the console (CMD).

Last edited by StefanM; 05.06.2022 at 16:27.
Reply With Quote
  #21  
Old 05.06.2022, 16:24
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,289
Default

Quote:
Originally Posted by StefanM View Post
Only *.avi* is matching file names where you find .avi somewhere in the middle of that name.
that*s not how the simple search works and changing it will just break it for everyone else that used it like that. We can add *optional* mode for this
and make it default for new installations but not for existing ones
__________________
JD-Dev & Server-Admin
Reply With Quote
  #22  
Old 05.06.2022, 16:26
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,289
Default

Quote:
Originally Posted by StefanM View Post
Sorry, I do not agree!
We have a bug here.
I don't agree but I will change behaviour and we will see how many ppl will complain about it and then add optional *old mode* back
__________________
JD-Dev & Server-Admin
Reply With Quote
  #23  
Old 05.06.2022, 16:34
StefanM's Avatar
StefanM StefanM is offline
JD VIP
 
Join Date: Oct 2020
Posts: 485
Default

Quote:
Originally Posted by Jiaz View Post
I don't agree but I will change behaviour and we will see how many ppl will complain about it and then add optional *old mode* back
OK, I will try to google for 'simple wildcard mode' or whatever this mode may be called. Maybe it really exists. If it does, I never heard of that before...

Still prepared to learn new things

And of course I do not know your URS, how it was specified in the first place...
But I'm convinced that anybody familiar with using wildcards will not complain when you change it.
Just look at any program supporting wildcard searches. All programs I know, work the way I described it. And people using wildcards for searching will be used to that way.

Last edited by StefanM; 05.06.2022 at 16:40.
Reply With Quote
  #24  
Old 05.06.2022, 16:39
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,289
Default

@StefanM: it's just the way we implemented it. You are right about the *how a wildcard* should work and I don't disagree with that. I'm just saying that changing how things worked since ages can easily break stuff when ppl rely on *how it used to work*.
Just testing my changes and next core update will be available shortly.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #25  
Old 05.06.2022, 17:00
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,289
Default

@StefanM: Please check if it works like expected with next core update. update will be available within next 5 mins
__________________
JD-Dev & Server-Admin
Reply With Quote
  #26  
Old 05.06.2022, 17:06
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,289
Default

@StefanM: some personal words .... I DO agree with you on this one! (how wildcards should work) but forgive me for my words...I sometimes really have to struggle to understand/find out what you're really trying to say!

For example, https://board.jdownloader.org/showpo...93&postcount=4
Here you just wrote wildcards don't work but actually you wanted to say that the result of this search is not what you've expected, due to different expectationshow wildcards should work. In the end I do agree with you but I really find it stressful to come to the point where both parties finally *talk* about the same topic/issue.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #27  
Old 05.06.2022, 17:17
StefanM's Avatar
StefanM StefanM is offline
JD VIP
 
Join Date: Oct 2020
Posts: 485
Default

Quote:
Originally Posted by Jiaz View Post
@StefanM: some personal words .... I DO agree with you on this one! (how wildcards should work) but forgive me for my words...I sometimes really have to struggle to understand/find out what you're really trying to say!
Well, is there a way to contact you in private? (you disabled PMs, for sure for a good reason) But you could send me a PM on how to contact you. Or I could answer your PM and send you my phone number...

I'd really like to answer your question, so you better understand.
Reply With Quote
  #28  
Old 05.06.2022, 17:23
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,289
Default

@StefanM: Yes, there is a reason I've disabled PMs It's okay to write here on board and you can also contact me via jiaz@jdownloader.org
I just wanted to explain that it's stressful to have long conversation just to reach a point where finally both parties speak of the same in this case a simple *I think wildcard works differently than I expect* would be better than *wildcards don't work*

The core update is available, please test and provide feedback if it now works like expected
__________________
JD-Dev & Server-Admin
Reply With Quote
  #29  
Old 05.06.2022, 17:28
StefanM's Avatar
StefanM StefanM is offline
JD VIP
 
Join Date: Oct 2020
Posts: 485
Default

Quote:
Originally Posted by Jiaz View Post
The core update is available, please test and provide feedback if it now works like expected
Just made short test with file names:
Yes, it works a expected and I assume it'll work for package names, etc. the same way?

Will send you an email within the next minutes.
Reply With Quote
  #30  
Old 05.06.2022, 17:32
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,289
Default

Quote:
Originally Posted by StefanM View Post
Yes, it works a expected and I assume it'll work for package names, etc. the same way?
It's the same method for searchbar and packagizer/filter/view rules, hence my fear that it may easily break user configuration
__________________
JD-Dev & Server-Admin
Reply With Quote
  #31  
Old 05.06.2022, 18:19
StefanM's Avatar
StefanM StefanM is offline
JD VIP
 
Join Date: Oct 2020
Posts: 485
Default

Quote:
Originally Posted by Jiaz View Post
It's the same method for searchbar and packagizer/filter/view rules, hence my fear that it may easily break user configuration
Well, I would assume that the majority of users being able to create their own filters, would use RegEx, same as I did in the past.

Because those who would have tried to use wildcards, would have encountered the same problems I encountered and then (as I did it) gave up trying to use wildcards and instead used RegEx.

PS: Sent you an email. And maybe you should edit your post with you mail address, so that your mailbox won't get flooded with unwanted mails or even spam, once bots have found it.

What I didn't know or forgot, how to use/enable RegEx in the search bar. And I only found out about '|' as separator (in non-RegEx mode) because this is also being used in grepWin. In many programs I know ';' is used as separator in non-RegEx mode.

PS note:
Don't want to nag you, but if there were a changelog, users would know, why their filter using wildcards would not work any longer
But I'm curious, if there will be any complaints at all. And then you know how many users used the non-RegEx mode.


Last edited by StefanM; 05.06.2022 at 18:22.
Reply With Quote
  #32  
Old 05.06.2022, 18:35
StefanM's Avatar
StefanM StefanM is offline
JD VIP
 
Join Date: Oct 2020
Posts: 485
Default

Quote:
Originally Posted by Jiaz View Post
I'm sorry but what do you mean? It's normal java Regex/Pattern.
Before I write too much, the screenshot will explain my question
Attached Thumbnails
Delimiters.jpg  
Reply With Quote
  #33  
Old 05.06.2022, 19:16
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,289
Default

Quote:
Originally Posted by StefanM View Post
Before I write too much, the screenshot will explain my question
You've got to switch to Java. PHP Syntax is different than Java
__________________
JD-Dev & Server-Admin
Reply With Quote
  #34  
Old 05.06.2022, 19:26
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,289
Default

Quote:
Originally Posted by StefanM View Post
PS: Sent you an email. And maybe you should edit your post with you mail address, so that your mailbox won't get flooded with unwanted mails or even spam, once bots have found it.
My e-mail is nothing to hide You can find it several times on this board. I will read/response asap
__________________
JD-Dev & Server-Admin
Reply With Quote
  #35  
Old 05.06.2022, 19:44
StefanM's Avatar
StefanM StefanM is offline
JD VIP
 
Join Date: Oct 2020
Posts: 485
Default

Quote:
Originally Posted by Jiaz View Post
You've got to switch to Java. PHP Syntax is different than Java
Now...
... I don't understand :(

I can work with RegEx, even though I'm far from being a RegEx expert.

In different applications, I have to use different delimiters:
e.g. SpeedCommander uses another delimiter than EPF does.
Both are Windows programs and I enter my RegEx's in their GUIs.
I consider JD's GUI also a Windows GUI. But of course I see the differences, e.g. when browsing for a directory.

But if there are additional differences because J(ava)Downloader is programmed in Java, I'm afraid I don't understand.

And when it comes to Java, I simply have no experience at all. That's probably why I don't understand what you want to tell me.
Reply With Quote
  #36  
Old 05.06.2022, 20:02
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,289
Default

Quote:
Originally Posted by StefanM View Post
Now...
... I don't understand :(
@StefanM: in regex101,on the left side, you have to choose Java mode! Syntax is different than for example PHP mode.
You have to escape "quotation mark" and "backslash" and metacharacters, for example see
baeldung.com/java-regexp-escape-char
docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html
en.wikipedia.org/wiki/Regular_expression#Delimiters
__________________
JD-Dev & Server-Admin

Last edited by Jiaz; 05.06.2022 at 20:11.
Reply With Quote
  #37  
Old 07.06.2022, 19:00
StefanM's Avatar
StefanM StefanM is offline
JD VIP
 
Join Date: Oct 2020
Posts: 485
Default

Quote:
Originally Posted by Jiaz View Post
@StefanM: in regex101,on the left side, you have to choose Java mode! Syntax is different than for example PHP mode.
You have to escape "quotation mark" and "backslash" and metacharacters, for example see
baeldung.com/java-regexp-escape-char
docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html
en.wikipedia.org/wiki/Regular_expression#Delimiters
Thanks! I was just too blind to see.
Even though I already managed to create working RegEx's in JD's filters in the past
Reply With Quote
  #38  
Old 07.06.2022, 19:12
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,289
Default

Quote:
Originally Posted by StefanM View Post
Thanks! I was just too blind to see.
Nothing to thank me for
__________________
JD-Dev & Server-Admin
Reply With Quote
  #39  
Old 08.06.2022, 19:37
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,289
Default

@StefanM: first breaking of existing rules, https://board.jdownloader.org/showthread.php?t=90856
__________________
JD-Dev & Server-Admin
Reply With Quote
  #40  
Old 08.06.2022, 19:46
StefanM's Avatar
StefanM StefanM is offline
JD VIP
 
Join Date: Oct 2020
Posts: 485
Default

Quote:
Originally Posted by Jiaz View Post
@StefanM: first breaking of existing rules, **External links are only visible to Support Staff**...
ok, I see.
Now let's see how many users will complain...

I would say not more than 5.
What is your guess?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 14:45.
Provided By AppWork GmbH | Privacy | Imprint
Parts of the Design are used from Kirsch designed by Andrew & Austin
Powered by vBulletin® Version 3.8.10 Beta 1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.