Find component matching regular expression is incorrect

Editors for WPF Forum

Posted 6 months ago by Sunshine - Appeon
Version: 21.1.3
Platform: .NET 5.0
Environment: Windows 10 (64-bit)
Avatar

There seem to be many problems with the function of finding regular expressions.

For example:

(1) Expression: ([a-z]\1)  Text:  "a1  aa"

The matching result is "a1", but the actual correct value should be "aa".

(2) Expression: (ss?)  Text:  "ss s"

The expected behavior should be the first search for ss of range [1,2],

The second search for s of range [2,2]

The second search for s of range [4,4]

But there is actually no result of the second search.

Comments (3)

Posted 6 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Thank you for reaching out. SyntaxEditor does not currently support "\1" as a backreference match. Any unrecognized escape sequences will match on the character after the "\". In this case, that is why you are seeing the match on the literal value "1". Supporting backreferences is something we can research for a future update.  You can find full documentation on what is supported here:

https://www.actiprosoftware.com/docs/controls/wpf/syntaxeditor/regular-expressions/language-elements

The behavior you are describing in the second scenario is the behavior we would expect. The pattern "(ss?)" should match on both characters. When you perform a "Find Next" it will start after the previous match. This is why the "s" at range [2,2] is not matched because it was already part of the previous match. I tested Visual Studio 2022 and saw similar behavior to what you are describing, but other editors I tested (including VS Code and Notepad++) behave the way SyntaxEditor behaves. Visual Studio's current behavior may be a bug.


Actipro Software Support

Posted 6 months ago by Sunshine - Appeon
Avatar

How can I implement the search logic by expanding myself? At present, I have not found a way to expand. We have solved the regular expression matching problem by ourselves, but it cannot be applied to the control

Posted 6 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

The built-in search overlay pane does not currently support any extensions that would allow for custom search logic, but I have made a note about the inquiry. At this time the only option would be to disable the built-in search overlay pane and replace it with one of your own design.


Actipro Software Support

The latest build of this product (v22.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.