Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Syntax highlighting with AvalonEdit

I am trying to write a regex for AvalonEdit.TextEditor to mark everything after the second | a certain color.

Example(value should be a color):

action|key|value

I am trying something like this but it doesn't work because I can't specify the group I wanna color.

^[^\|]*\|[^\|]*\|(?P<value>[^\|]*)

Any ideas?

like image 269
Alioooop Avatar asked Apr 10 '26 22:04

Alioooop


1 Answers

Try this: (?<=[^\|]+\|[^\|]+\|)(?<value>[^\|]+)

The positive look-behind (?<=) will make sure action and key are not part of the match.

Normally you shouldn't use non-fixed length look-behinds but maybe this works for you.

like image 191
Manfred Radlwimmer Avatar answered Apr 12 '26 10:04

Manfred Radlwimmer