Potential Issue with RegEx Searches

SyntaxEditor for WPF Forum

Posted 11 years ago by \アッカリーン/
Version: 13.1.0581
Avatar

When attempting to search using Regular Expressions and built-in .NET character classes, I'm getting some errors back. For example, \p{Lu} works just fine when searching for uppercase letters, however \p{IsBasicLatin} is returning an error. Both should work with .NET by default as described here (http://msdn.microsoft.com/en-us/library/20bw873z%28v=vs.80%29.aspx).

Here's the exception I'm getting:

System.ArgumentException: Invalid Unicode category name.
Parameter name: categoryName
at ActiproSoftware.Text.RegularExpressions.CharClass.#mad(String #CCf)
at ActiproSoftware.Text.RegularExpressions.CharClass.AddCategory(String categoryName, Boolean negate)
at #kZc.#jE.#1U(Int32 #mvf, Boolean #YCf)
at #kZc.#jE.#1U(Int32 #mvf, Boolean #YCf)
at #kZc.#jE.#VU(String #UCf, Boolean #VCf, Boolean #WCf, CaseSensitivity #XCf)
at #kZc.#jE.#6U(String #UCf, Boolean #VCf, Boolean #WCf, CaseSensitivity #XCf)
at #2Yc.#fZc.#C7c(ISearchOptions #qgb)
at #2Yc.#fZc.#F7c(SearchOperationType #Myf, ITextSnapshot #I7b, ISearchOptions #qgb, Int32 #Oqc, Boolean #fCf, TextRange #eCf)
at #2Yc.#fZc.FindNext(ITextSnapshot #I7b, ISearchOptions #qgb, Int32 #Oqc, Boolean #fCf, TextRange #eCf)
at #Q2b.#JZc.FindNext(ISearchOptions #qgb, Int32 #Oqc, Boolean #fCf, TextRange #eCf)
at #Q2b.#JZc.FindNext(ISearchOptions #qgb, Int32 #Oqc, Boolean #fCf)
at fire.MainWindow.<>c__DisplayClass3b.<AdvancedSearch_ProcessAdvancedSearch>b__38(Object a, DoWorkEventArgs b)

Here's basically what I'm doing:

EditorSearchOptions eso = new EditorSearchOptions();
eso.FindText = "\p{IsBasicLatin}";
eso.MatchCase = false;
eso.PatternProvider = SearchPatternProviders.RegularExpression;
eso.SearchUp = false;

snapshot.FindNext(eso, offset, true);

Thanks

Comments (2)

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

Hello,

Our regex engine is a custom engine and is not the .NET one, although the syntax is pretty much a subset of the .NET one.  Our \p{} just supports Unicode general categories.  What you are describing is a Unicode named group.  We don't currently have support for those.

You could always search on a character class with the appropriate character ranges for your named group instead.


Actipro Software Support

Posted 11 years ago by \アッカリーン/
Avatar

Okay, I'll write something special in to substitute for character classes instead. Thanks.

The latest build of this product (v24.1.3) 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.