Regex issue

General discussion related to "Everything".
Post Reply
Debugger
Posts: 531
Joined: Thu Jan 26, 2017 11:56 am

Regex issue

Post by Debugger » Mon Sep 17, 2018 4:51 pm

How to find all characters = except for three characters =
My regex is incorrect:

^={3}

therube
Posts: 2372
Joined: Thu Sep 03, 2009 6:48 pm

Re: Regex issue

Post by therube » Mon Sep 17, 2018 11:04 pm

[^===]
eh, that's probably not right...
^[^===]
& thinking that isn't quite it either!

therube
Posts: 2372
Joined: Thu Sep 03, 2009 6:48 pm

Re: Regex issue

Post by therube » Tue Sep 18, 2018 12:55 am

Disregarding RegEx:

!"===" =

Find files with = in the filename, but not with 3 ===, so 1 or 2 or >3.

Debugger
Posts: 531
Joined: Thu Jan 26, 2017 11:56 am

Re: Regex issue

Post by Debugger » Tue Sep 18, 2018 6:59 am

[^===]
^[^===]
!"===" =

All Regex does not work because nothing is found.

-----
Can not find
-----
Example:
===
=====
=
=====================================

should only find 3 characters ===

Test: Perl Search Engine Emeditor 18.0.9

void
Site Admin
Posts: 4983
Joined: Fri Oct 16, 2009 11:31 pm

Re: Regex issue

Post by void » Tue Sep 18, 2018 7:34 am

Please try searching for:
^(?!.*===).*$

or, to find atleast one =, but not 3 sequential =
^(?!.*===).*=.*$

or, to find atleast one =, but not 3 sequential =, or 4 or more sequential =
(^(?!.*===).*=.*$)|====+

tuska
Posts: 201
Joined: Thu Jul 13, 2017 9:14 am

Re: Regex issue

Post by tuska » Tue Sep 18, 2018 8:55 am

Debugger wrote: Example:
===
=====
=
=====================================

should only find 3 characters ===

Code: Select all

^={3}$
?
If it fits, it was a lucky strike today :D

Does not find:
===== ===

Debugger
Posts: 531
Joined: Thu Jan 26, 2017 11:56 am

Re: Regex issue

Post by Debugger » Tue Sep 18, 2018 9:02 am

void tuska

The first regex ignores =
The second Regex finds only one character
I want to find at least one character to change into 3 characters.
But the regex can not include the character = in any http link!

Ignore =
http://bla bla/lbla bla=22041

Include =

Ignore
==
====
and more...

NotNull
Posts: 1595
Joined: Wed May 24, 2017 9:22 pm

Re: Regex issue

Post by NotNull » Tue Sep 18, 2018 9:20 am

= !regex:^[^=]*===[^=]*$


And if this is not for Everything, this thread should definitely be moved to the Off-topic discussion, as similar threads by @Debugger have already caused a lot of confusion that way

Debugger
Posts: 531
Joined: Thu Jan 26, 2017 11:56 am

Re: Regex issue

Post by Debugger » Tue Sep 18, 2018 9:30 am

NotNull -
Regex only works with 3 characters =
How to change a different number of characters (except for 3 characters
and except individual characters in an HTTP link)???


= replace with ===
== replace with ===
===
http://bla bla/lbla bla=22041 (NOT replace)
= OR == OR ==== OR more character "=" always replace with ===

NotNull
Posts: 1595
Joined: Wed May 24, 2017 9:22 pm

Re: Regex issue

Post by NotNull » Tue Sep 18, 2018 9:46 am

I don't understand what you are saying/asking.

If you enter
= !regex:^[^=]*===[^=]*$
on the Everything search bar, you get all files with at least one "=", but not the ones with exactly 3 "=" in a row (4 or more in row will be found).

Debugger
Posts: 531
Joined: Thu Jan 26, 2017 11:56 am

Re: Regex issue

Post by Debugger » Tue Sep 18, 2018 11:10 am

NotNull -
^[^=]*===[^=]*$
OR

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


We are not talking about the Everything program about the change in the word editor.
Of course, it will not work in any text editor when I want to replace something in a text file.


Each character = (except for 3 characters === and one character in http) should be replaced with 3 characters ===


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 = character, and I want to replace all of them with 3 characters =

NotNull
Posts: 1595
Joined: Wed May 24, 2017 9:22 pm

Re: Regex issue

Post by NotNull » Tue Sep 18, 2018 3:38 pm

Tried it in Libre Office Writer.
Did a Search/Replace on the second part:
2018-09-18 17_35_01-Untitled 1 - LibreOffice Writer.png
You do not have the required permissions to view the files attached to this post.

Debugger
Posts: 531
Joined: Thu Jan 26, 2017 11:56 am

Re: Regex issue

Post by Debugger » Tue Sep 18, 2018 4:16 pm

NotNull


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 =


Line1:http://www.com.pl/11= (VARIOUS TYPE URL)
Line2:====

Find:^=*$
Replace with:===

NotNull
Posts: 1595
Joined: Wed May 24, 2017 9:22 pm

Re: Regex issue

Post by NotNull » Tue Sep 18, 2018 4:30 pm

Do the lines where the ='s should be replaced all start with "===" (no more and no less than 3 ='s)?
Do all the URL-lines start with http?

Some real world examples would help.

Debugger
Posts: 531
Joined: Thu Jan 26, 2017 11:56 am

Re: Regex issue

Post by Debugger » Tue Sep 18, 2018 4:38 pm

1. Beginning lines with character = starting from 1 to unknown
2. Beginning lines from the url begin with http or https

NotNull
Posts: 1595
Joined: Wed May 24, 2017 9:22 pm

Re: Regex issue

Post by NotNull » Tue Sep 18, 2018 5:33 pm

Then it is simple:

search for:
^=*

replace with:
===

Debugger
Posts: 531
Joined: Thu Jan 26, 2017 11:56 am

Re: Regex issue

Post by Debugger » Tue Sep 18, 2018 6:08 pm

NotNull wrote:Then it is simple:

search for:
^=*

replace with:
===
Missing End of Line:$
Your regex is incorrect :lol: because it adds in a line ===http................
My off course is completely correct!

Regular Expression Engine: Onigmo, Perl, Boost.Regex

NotNull
Posts: 1595
Joined: Wed May 24, 2017 9:22 pm

Re: Regex issue

Post by NotNull » Tue Sep 18, 2018 6:34 pm

Did you miss the ^ in the search string?
the ^ anchors at the beginning of the line, followed by any number of ='s
In no regex language that I'm aware of this is defined differently.

Ergo: It will *only* replace anything in lines that start with an =
2018-09-18 20_27_31-Untitled 1.odt - LibreOffice Writer.png
You do not have the required permissions to view the files attached to this post.

Debugger
Posts: 531
Joined: Thu Jan 26, 2017 11:56 am

Re: Regex issue

Post by Debugger » Wed Sep 19, 2018 6:28 am

I do not use LibreOffice, only Emeditor. Without a $ character, it replace incorrectly in the case of a URL. That's why he is required in this case.

Post Reply