Multiple RegexPatterns in definition

SyntaxEditor for Windows Forms Forum

Posted 19 years ago by Paul Huckstepp - United Kingdom
Avatar
One of my SE2.5 HTML definition files has the segment below in it that is used to colour HTML table tags a certain colour. Since upgrading to v3 and making the changes in the 2-3 upgrade guide the table tags are no longer working and I cannot work out why:

<State Key="StartTableState" TokenKey="StartTagDefaultToken" Style="TableConstruct">
   <Scopes>                
    <Scope>
      <RegexPatternGroup Type="StartScope" TokenKey="StartTagStartToken" Style="TableConstruct" PatternValue="&lt;(table|tr|td|th|tbody|thead|/table)"  />
      <RegexPatternGroup Type="EndScope" TokenKey="StartTagEndToken" Style="TableConstruct" PatternValue="&gt;" />    
    </Scope>
   </Scopes>
   <ChildStates>
     <ChildState Key="StartTagAttributeValueState" />
     <ChildState Key="ASPDirectiveResponseWriteState" />
     <ChildState Key="ASPDirectiveCodeState" />
   </ChildStates>
</State>
Other similar definitions are working but it seems that ones that use (item1|item2) regular expression chunk don't work.


Have I missed something?

Comments (4)

Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Paul,

It must be something different with the regex parser that was altered. Do this:
PatternValue="<((table)|(tr)|(td)|(th)|(tbody)|(thead)|(/table))"
That seems to work fine.


Actipro Software Support

Posted 19 years ago by Paul Huckstepp - UK
Avatar
Thats great, worked a treat, thanks for the help.

Paul Huckstepp
Posted 19 years ago by Boyd - Sr. Software Developer, Patterson Consulting, LLC
Avatar
Not being able to use the standard OR (|) operator in a RegEx (without grouping the item in parenthesis) will be a bit confusing to end users who expect it to work like the .NET RegEx engine. Is this something you plan to address for the next maintenance release?
Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
It appears that our order of precedence for the regex engine needs to be tweaked to have alternatives (|) at the lowest end of precedence. We'll work on this.


Actipro Software Support

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