Page 1 of 1

Regex issue

Posted: Mon Sep 17, 2018 4:51 pm
by Debugger
How to find all characters = except for three characters =
My regex is incorrect:

^={3}

Re: Regex issue

Posted: Mon Sep 17, 2018 11:04 pm
by therube
[^===]
eh, that's probably not right...
^[^===]
& thinking that isn't quite it either!

Re: Regex issue

Posted: Tue Sep 18, 2018 12:55 am
by therube
Disregarding RegEx:

!"===" =

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

Re: Regex issue

Posted: Tue Sep 18, 2018 6:59 am
by Debugger
[^===]
^[^===]
!"===" =

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

Re: Regex issue

Posted: Tue Sep 18, 2018 7:34 am
by void
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 =
(^(?!.*===).*=.*$)|====+

Re: Regex issue

Posted: Tue Sep 18, 2018 8:55 am
by tuska
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:
===== ===

Re: Regex issue

Posted: Tue Sep 18, 2018 9:02 am
by Debugger
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...

Re: Regex issue

Posted: Tue Sep 18, 2018 9:20 am
by NotNull
= !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

Re: Regex issue

Posted: Tue Sep 18, 2018 9:30 am
by Debugger
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 ===

Re: Regex issue

Posted: Tue Sep 18, 2018 9:46 am
by NotNull
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).

Re: Regex issue

Posted: Tue Sep 18, 2018 11:10 am
by Debugger
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 =

Re: Regex issue

Posted: Tue Sep 18, 2018 3:38 pm
by NotNull
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
2018-09-18 17_35_01-Untitled 1 - LibreOffice Writer.png (17.28 KiB) Viewed 290 times

Re: Regex issue

Posted: Tue Sep 18, 2018 4:16 pm
by Debugger
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:===

Re: Regex issue

Posted: Tue Sep 18, 2018 4:30 pm
by NotNull
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.

Re: Regex issue

Posted: Tue Sep 18, 2018 4:38 pm
by Debugger
1. Beginning lines with character = starting from 1 to unknown
2. Beginning lines from the url begin with http or https

Re: Regex issue

Posted: Tue Sep 18, 2018 5:33 pm
by NotNull
Then it is simple:

search for:
^=*

replace with:
===

Re: Regex issue

Posted: Tue Sep 18, 2018 6:08 pm
by Debugger
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

Re: Regex issue

Posted: Tue Sep 18, 2018 6:34 pm
by NotNull
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
2018-09-18 20_27_31-Untitled 1.odt - LibreOffice Writer.png (33.63 KiB) Viewed 267 times

Re: Regex issue

Posted: Wed Sep 19, 2018 6:28 am
by Debugger
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.