Skip to content

Rule Regex doesn't work as expected #392

Closed
@MathiasLui

Description

Hey, I've got a syntax highlighting rule that should match the first word of each line like this:
<Rule color="CmdOrVar"> ^[+\-_a-zA-Z]([\w]*)?(\s|$) </Rule>
and it works when trying it on regexr:
image
But in the Editor it looks like this and it feels like it's deciding for each word instead of each line:
image

Activity

MathiasLui

MathiasLui commented on Mar 12, 2023

@MathiasLui
Author

I have tried so long for different solutions for this as well as some other things and it feels impossible to do anything more with regex than just highlighting certain keywords, strings or comments...

Is there maybe a way to write my own logic for highlighting text, based on code instead of regex?

jimfoye

jimfoye commented on Mar 12, 2023

@jimfoye
Contributor

You can derive a class from DocumentColorizingTransformer.

MathiasLui

MathiasLui commented on Mar 13, 2023

@MathiasLui
Author

Thanks I'll try that!

MathiasLui

MathiasLui commented on Mar 14, 2023

@MathiasLui
Author

Thanks, I managed to make that work, uglily, but it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Rule Regex doesn't work as expected · Issue #392 · icsharpcode/AvalonEdit