Git Product home page Git Product logo

Comments (11)

pyscripter avatar pyscripter commented on August 15, 2024

Could you please provide some more explanations. What is the expected outcome and what is the actual?

Also, what is the change you are suggesting?

from synedit.

JaFi-cz avatar JaFi-cz commented on August 15, 2024

Current situation, when roNotEmpty is included in default and you have no possibility to remove it leads to "wrong regular expression" message when you try to search for ^ or $ only. It disallows you insert content of the replace expression on any lines start or end.
Try my example with current Synedit version, remove roNotEmpty option (it's on 3 places in SynEditRegExpSearch.pas unit) and try it again. You will see the difference.

The change I suggest is remove roNotEmpty option, cause it's automatically added to any options you use.

from synedit.

pyscripter avatar pyscripter commented on August 15, 2024

I see...

cause it's automatically added to any options you use.

How do you conclude that?

from synedit.

JaFi-cz avatar JaFi-cz commented on August 15, 2024
constructor TSynEditRegexSearch.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  fOptions := [roNotEmpty];
end;
...
procedure TSynEditRegexSearch.SetOptions(const Value: TSynSearchOptions);
begin
  if ssoMatchCase in Value then
    fOptions := [roNotEmpty]
  else
    fOptions := [roNotEmpty, roIgnoreCase];
  RegEx := TRegEx.Create(fPattern, fOptions);
  RegEx.SetAdditionalPCREOptions(PCRE_UCP);
end;

from synedit.

pyscripter avatar pyscripter commented on August 15, 2024

Just to make sure. Are you suggesting that we remove reNotEmpty from the constructor only and keeping it in SetOptions?

from synedit.

JaFi-cz avatar JaFi-cz commented on August 15, 2024

No, I mean remove it from constructor and set options. It has no influence of search.
Az alternative you can make it optional, but it means add property

from synedit.

pyscripter avatar pyscripter commented on August 15, 2024

But if I remove it from SetOptions it will never be set and empty matches could always happen.

from synedit.

JaFi-cz avatar JaFi-cz commented on August 15, 2024

This is what I wrote as alternative solution - make it optional (add property) in RegExp Synedit engine
Empty expression were there in the past before Delphi reg exp engine in Synedit.

from synedit.

pyscripter avatar pyscripter commented on August 15, 2024

Empty expression were there in the past before Delphi reg exp engine in Synedit

I could not find such an option in https://github.com/SynEdit/SynEdit/.

from synedit.

pyscripter avatar pyscripter commented on August 15, 2024

I committed anyway since your use case is common.
We should rethink how to expose roNotEmpty and other PCRE options to TSynEditRegexSearch.

from synedit.

JaFi-cz avatar JaFi-cz commented on August 15, 2024

Yes, in old implementation was no such options, but behavior was as I described

from synedit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.