We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Lexem with Regular Expressions

I'm having a hard time getting Lexems to work with Regular Expressions.
 
I am trying to color code a formula. I need to be able to color code tokens even if they aren't surrounded by a blank space.
 
In the following Formula, How do I write the lexem to set the color of the tokens Inv StartToEcl and Prior?
 
if ( CurrentDate = CaseStart,
    Abandonment[Inv,StartToECL],
    AbdnCurrentDol[Prior]
)
 
I'm able to color CurrentDate, as it has white space on either side of it. CaseStart, isn't found though.
 
if I use \W or \w or \b, I get the entire line color coded. I only want the token itself colored. How can I accomplish this?
 
lx.Add(new Lexem
                {
                    StartText = @"\WPrior\W",
                    IsRegex = true,
                    ContainsEndText = false,
                    IsMultiline = false,
                    LexemType = EditTokenType.Keyword,
                    FormatName = "KeywordFormat"
                });
 
 
 

3 Replies

MH Marty Honea January 24, 2013 05:12 PM UTC

Ok, I've found the Regular Expression that should work.
 
According to this link
 
Lookbacks and Lookforwards are what I was missing.
 
So I created the Regex (?<=\W)Inv+(?=\W)|Inv
This works, in a way. It finds Inv in the formula. But it also highlights the entire row instead of just the match I'm looking for.
 
How can I make it only highlight the match?


MH Marty Honea January 28, 2013 06:50 PM UTC

For anyone else who's searching this forum with this issue, I've created an Incident with SyncFusion and gotten confirmation that this is indeed broken. They'll be correcting it in a future release.


AX Antony Xavier D Syncfusion Team February 4, 2013 12:16 PM UTC

Hi Marty,

Thanks for your update.

Regarding the patch please follow up the incident #103663 for further updates.

Regards,

Antony.


Loader.
Live Chat Icon For mobile
Up arrow icon