Regular expression trouble in Emacs: how do I highlight all lines that begin with "//"?
I would like to gray out my comments in text mode but the following snippet doesn't seem to work:
(add-hook 'text-mode-hook
(lambda()
(font-lock-add-keywords nil
'(("^//.+"
1 font-lock-comment-face prepend)))))
'Re-builder' indicated that this kind of expression should do the trick. What's wrong? Thanks!
Okay, I figured it out. "^\\(//.*\\)$"
does the job.
Sorry for possible "spam". I did google for almost two hours beforehand; regular expressions just seem to be way above my head.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With