Regular expession in Find dialog ignores whitespace

SyntaxEditor for WPF Forum

Posted 9 years ago by Roy Versteeg
Version: 14.2.0610
Avatar

We are using the built-in search functionality to search in an Actipro syntaxeditor. When trying to do a Regular Expression search the space ' ' character is not treated as expected.

For example in the Sample Browser in the sample "Search - Find Results", when i use pattern "public class" ( without the quotes ) it doesn't find any results. When I use "public\sclass" it does find the expected part of the file.

It seams the Actipro component is using the IgnorePatternWhitespace regex option. Is it possible to change this behavior?

Comments (1)

Answer - Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Roy,

That is correct, we have ignore whitespace on in the regex search pattern provider, so you would need to use "\s" in place of space characters.

If you wish to change it, you can make a new ISearchPatternProviderFactory, and set that to the EditorSearchView.SearchPatternProviderFactory property.  The options for the default factory all come from the static SearchPatternProviders class.  You could make a custom ISearchPatternProvider that takes the pattern passed into GetFindPattern and converts space characters to "\s".  Then use that in place of the regex one we provide.  That would accomplish what you want.


Actipro Software Support

The latest build of this product (v24.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.