No, this is not a replicate of The ':' character, hexadecimal value 0x3A, cannot be included in a name
I have a Regex for my syntax highlighter for my scripting language:
`@"\bClass+(?<range>\w+?)\b"`
which basically marks Class Name
(with the engine I got online)
I'm no master in Regex but for some reason the :
character that uses my language to create labels - doesn't work.
I tried
@"\b:+(?<range>\w+?)\b"`, `@"\b\:+(?<range>\w+?)\b"`<RB> `@"\b(\x3A)+(?<range>\w+?)\b"
And it refuses to work!
Any ideas?
I suspect the issue in your case is not the :
itself, but the \\b
before it. \\b
marks the boundary between a word character and nonword character, but while Class
is comprised of word characters, :
is a nonword character. So \\b
is behaving differently for :
than it would for Class
, so:
`\bClass` matches " Class Name"
`\b:` does not match " : Name"
If you use your original expression but replace the first \\b
with (?<!\\w)
, it may identify the :
properly.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.