Skip to content

Syntax Highlighting Error with Dash De-limited Words #22

@bmarcaur

Description

@bmarcaur

Example:
highlighting dash

Currently most of the regex's use word boundaries as their bounding for highlighting, yet using variable names with dash casing will be captured in the regex's. Also in the screen shot above builtin bash strings will highlight even if they are the beginning of a word that is delimited by dashes.

I started by using this look behind:

(?<!-)

to ignore words that follow a dash but I quickly realized that this was gonna be very verbose and really stemmed from the nature of word boundaries in regex. Regex treats '-' as a boundary while bash does not. So to remedy this issue I was thinking that I could replace all the \b with a better definition of a bash centric word boundary. Something like (?<![\w-])(EXPR)(?![\w-])

What are your thoughts on this approach?

Thanks

Metadata

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