JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1  
Old 18.09.2018, 10:04
djmakinera djmakinera is offline
JD Legend
 
Join Date: May 2010
Location: Poland
Posts: 7,754
Default Finding characters "="

1. I want to find only 3 characters ===
2. I want to ignore find every other number of characters =
3. I want to find all characters = containing a different number than 3 characters =

All regex not work:

[^ ===]
^ [^ ===]
! "===" =
Reply With Quote
  #2  
Old 18.09.2018, 12:54
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 59,535
Default

How about learning regex and not guessing?
It seems you doesn't even know what [] is ?

This is the pattern for your first question
Code:
([^=]|^)(===)([^=]|$)
__________________
JD-Dev & Server-Admin
Reply With Quote
  #3  
Old 18.09.2018, 14:17
djmakinera djmakinera is offline
JD Legend
 
Join Date: May 2010
Location: Poland
Posts: 7,754
Default

^={3}$
OR
^[^=]*===[^=]*$
OR
([^=]|^)(===)([^=]|$)


searches for 3 characters but that's not what I mean

I want:

Each character = (except for 3 characters === and one character in http) should be replaced with 3 characters ===
Reply With Quote
  #4  
Old 18.09.2018, 15:05
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 59,535
Default

Quote:
Originally Posted by djmakinera View Post
1. I want to find only 3 characters ===
that is what the pattern does, find the ===
__________________
JD-Dev & Server-Admin
Reply With Quote
  #5  
Old 18.09.2018, 15:06
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 59,535
Default

Quote:
Originally Posted by djmakinera View Post
Each character = (except for 3 characters === and one character in http) should be replaced with 3 characters ===
How about an example that everyone understands?
__________________
JD-Dev & Server-Admin
Reply With Quote
  #6  
Old 18.09.2018, 15:22
djmakinera djmakinera is offline
JD Legend
 
Join Date: May 2010
Location: Poland
Posts: 7,754
Default

I have links in the text file that do not contain or contain at least one character or more in the address "="
Here he does not want to change anything.
But in the text file the links are separated in a line with a different combination of = chars, and I want to replace all of them with 3 characters =

= OR == OR ==== OR more character "=" always replace with ===
Line:
1.= replace with ===
2.== replace with ===
3.=== NOT REPLACE
4.==== replace with ===
5.===== or more = replace with ===
6.**External links are only visible to Support Staff****External links are only visible to Support Staff** name= NOT REPLACE
Reply With Quote
  #7  
Old 18.09.2018, 15:57
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 59,535
Default

Why not simply replace all =+ with === !?
__________________
JD-Dev & Server-Admin
Reply With Quote
  #8  
Old 18.09.2018, 16:09
djmakinera djmakinera is offline
JD Legend
 
Join Date: May 2010
Location: Poland
Posts: 7,754
Default

Because in the text file, there are http links with one or more characters =, and how they will replace the link will not work.
Reply With Quote
  #9  
Old 18.09.2018, 16:14
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 59,535
Default

So you're only interested in =... at the beginning of the line?
Maybe you should provide real example
__________________
JD-Dev & Server-Admin
Reply With Quote
  #10  
Old 18.09.2018, 19:07
djmakinera djmakinera is offline
JD Legend
 
Join Date: May 2010
Location: Poland
Posts: 7,754
Default

So you're only interested in =... at the beginning of the line?
YES.
Example not needed because from the beginning there are only character = of course in different quantities!

Line1:===============
Line2:====
Line3.======

etc.
Reply With Quote
  #11  
Old 18.09.2018, 19:15
djmakinera djmakinera is offline
JD Legend
 
Join Date: May 2010
Location: Poland
Posts: 7,754
Default

It works, but the regular expression must be changed because every character starts from the beginning of the line. There must be an exception for HTTP links in which the = CHARACTER also appears

Ignore replacing characters in any url link in which the character is =

Find:=*
Replace with:===

Line1:**External links are only visible to Support Staff****External links are only visible to Support Staff** (VARIOUS TYPE URL)
Line2:====
Reply With Quote
  #12  
Old 18.09.2018, 19:16
djmakinera djmakinera is offline
JD Legend
 
Join Date: May 2010
Location: Poland
Posts: 7,754
Default

Maybe:


Find:^=*$
Replace with:===
Reply With Quote
  #13  
Old 19.09.2018, 12:56
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 59,535
Default

Quote:
Originally Posted by djmakinera View Post
Maybe:


Find:^=*$
Replace with:===
That won't work because this pattern does only match empty lines or just with =
__________________
JD-Dev & Server-Admin
Reply With Quote
  #14  
Old 19.09.2018, 12:56
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 59,535
Default

How about
Code:
^=+
this pattern matches on LineBeginning-one or multiple =
__________________
JD-Dev & Server-Admin
Reply With Quote
  #15  
Old 19.09.2018, 14:51
djmakinera djmakinera is offline
JD Legend
 
Join Date: May 2010
Location: Poland
Posts: 7,754
Default

Works in both cases for me, I checked it on a text file.
Only in the first case is the $ character (End of line) required because the editor will show(when replace) for URL:
Code:
===http
Regular Expression Engine: Perl(Boost.Regex), Onigmo
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 03:10.
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 - 2019, Jelsoft Enterprises Ltd.