Jump to content
David Hoyle

GExperts Grep is always case sensitive when regular expressions are enabled

Recommended Posts

For some time I found that Grep, when regular expressions are enabled, is always case sensitive, regardless of the case-sensitive setting in the search dialogue.

I was going to try and trace the issue but I cannot build GExperts (see other posts).

Looking at the code it should support non-case-sensitivity searches.

Share this post


Link to post
2 hours ago, David Hoyle said:

Looking at the code it should support non-case-sensitivity searches.

It should, and it does, at least in my test in Delphi 2007: Seaching for "Then", whole word, not case sensitive as a regular expression, found several instances of "then":

 

Grep-case-sensitive.thumb.png.bdb3c0c1dda97e8c08c1575ba7320d25.png

 

Have you got an example where it doesn't work? And in which Delphi version does it fail? 10.4 ? 11.1 ?

Share this post


Link to post

In 10.4.2 unfortunately it does not.

For instance, searching for "ixt\w*" should find "IXTRelationshipFloat" however all it finds in my project group is "ixture" as part of "TestFixture". To find the interface I need to capitalise "IXT\w*".

Share this post


Link to post

Here are some screenshots from a test (with the same source file open)...

image.thumb.png.4cd649cc3e7cea6a3d0232dfb61fca98.png

image.thumb.png.6f25a52a61356eae445ae4cb9f2fe772.png

Share this post


Link to post

OK, I can reproduce that one with Delphi 10.4 but not with Delphi 2007. This might therefore be some kind of Unicode issue, even though I can't figure out how.

btw: It also happens with a much simpler regex: "ix" is enough.

 

If you can fix it, I'll gladly accept a patch of course. If you can't, please create a bug report and include these screenshots.

Share this post


Link to post

It's a problem with the SynEdit components suite. I've done some tests with the version of code you have in GExperts and the problem seems within the SynRegExpr unit. I've also opened up an old editor that uses SynEdit\SynEdit from GitHub which has the extract same SynRegExpr file and regex searches are case-sensitive. The TurboPack\SynEdit code works as expected (searches without case sensitivity) but that codebase no longer uses SynRegExpr.pas (guessing but I expect it uses the RTL code for regexs).

Share this post


Link to post
4 hours ago, David Hoyle said:

guessing but I expect it uses the RTL code for regex

indeed.

Share this post


Link to post

The current RegExpr unit on GitHub fixes that problem, but unfortunately it no longer compiles with pre UNICODE Delphis because somebody added a {$define Unicode} to it two years ago.

Share this post


Link to post

Wow, that's great support from Alex-T over on GitHub. He is currently helping me to fix those pesky compile problems, so I will be able to update SynRegExp with the original RegExpr unit.

  • Thanks 1

Share this post


Link to post

In case anybody wants to test it: This problem should be fixed in revision #3843

Share this post


Link to post

@dummzeuch I can confirm that this issue is resolved with the latest source and I can now perform case-insensitive searches with regular expressions.

  • Thanks 1

Share this post


Link to post
Posted (edited)

I am experiencing the same thing.  I currently have Version 1.3.21 build 3833 experimental installed.

 

Where can i download revision #3843?

 

 

Edited by MJBComp

Share this post


Link to post
Posted (edited)

Got it installed and solved the case-sensitivity search issue. Thank you.

 

 

Edited by MJBComp

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×