JDownloader Community - Appwork GmbH
 

Go Back   JDownloader Community - Appwork GmbH > English Support > General Discussion
Reply
 
Thread Tools Display Modes
  #1  
Old 14.06.2022, 08:11
MediaFanatic MediaFanatic is offline
Junior Loader
 
Join Date: Mar 2019
Posts: 12
Lightbulb Case-Insensitive Regex Flag \\i ?

When using regex in jDownloader rules, I've found posts that claim that starting the expression with \\i makes the regex case-insensitive.

I've tested this dozens of times and I cannot get it to work. If I remove the
\\i" from the beginning of a regex expression, it will work fine (when the case matches). When I add only the \\i - the expression no longer works.

I've never been able to confirm this is the correct method; my only source comes from searches on this forum.

Am I doing something wrong / should I be using a different code?

Thank you in advance
Reply With Quote
  #2  
Old 14.06.2022, 11:12
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,563
Default

@MediaFanatic:
please see Java Pattern docs
docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#CASE_INSENSITIVE
Quote:
Case-insensitive matching can also be enabled via the embedded flag expression (?i)
by default the pattern will auto enable DOTALL and CASE_INSENSITIVE modifier but you can
disable them by disabling them inline, for example
Quote:
Case-insensitive matching can also be disabled via the embedded flag expression (?-i)
__________________
JD-Dev & Server-Admin
Reply With Quote
  #3  
Old 15.06.2022, 03:19
MediaFanatic MediaFanatic is offline
Junior Loader
 
Join Date: Mar 2019
Posts: 12
Default

@Jiaz - Thank you, as always, you provided exactly the answer I needed and it now works perfectly!

I was not aware that jDownloader rules use the standard Java Pattern/flags, despite searching on this topic.

For sake of others who might be Googling for this information, I'll include some additional keywords:

Regular Expressions Case-Insensitive Search - Solved:

Prefix the Regex expression with (?i) for example (?i)(.*)?(SearchString)(.*)?$

Note: Due to the dotall, we explicitly refer to the end-of-line with pessimistic capture prior, to avoid capturing new-line characters.
Reply With Quote
  #4  
Old 15.06.2022, 11:39
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,563
Default

Quote:
Originally Posted by MediaFanatic View Post
@Jiaz - Thank you, as always, you provided exactly the answer I needed and it now works perfectly!
You're welcome!

Quote:
Originally Posted by MediaFanatic View Post
Note: Due to the dotall, we explicitly refer to the end-of-line with pessimistic capture prior, to avoid capturing new-line characters.
Names and URLs don't have newlines in them
__________________
JD-Dev & Server-Admin
Reply With Quote
Reply


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 15:27.
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.