What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 130 Stack Exchange communities.

This question already has an answer here:

Many questions about regex include code blocks with language agnostic, POSIX compatible patterns, using default prettifying. (example)

free hand circle is best

This looks kind of ugly and is confusing, since some parts are marked as literals.

How should regex code be handled? Should syntax highlighting just be disabled for regex using lang-none? I think correct syntax highlighting could improve it's readability, just by marking meta-characters and escaped meta-characters.

Including a language tag results in a different highlighting and seems superfluous when talking about POSIX regex - maybe even obstructive, since most people don't want to read questions about your . Including a language tag and using a full line of code, like String pattern = "[a-z0-9]+"; wouldn't add any valuable information. It would only get rid of the random highlights by showing the whole pattern as literal, so no advantage over disabling highlighting completely. Of course including a language tag has its advantage though and a new feature should wait imho until it is clear that a question's language tag hasn't just been forgotten.

share|improve this question

marked as duplicate by ben is uǝq backwards, hims056, Aziz Shaikh, animuson Oct 5 '13 at 16:16

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Yeah. Ick. I tried several of the language hints & didn't find any that really improved matters. –  M. Tibbits Aug 26 '11 at 8:32

1 Answer 1

up vote 5 down vote accepted

I think you'd need to submit a language filter to Google Code Prettify.

There is no lang-regex there yet.. but there could be if someone contributed one!

share|improve this answer
    
I took a look of the source and found that there actually is a lang-regex (Noticed it because I got some error when trying to create a filter with that name a few days ago). It seems it is used as part of a few languages supporting expressions enclosed in slashes, so it is not a full language and doesn't style anything. Along there is a TODO: maybe style special characters inside a regexp as punctuation.. A real lang-regex can probably even replace that. I'll experiment with it. –  kapep Sep 1 '11 at 10:21
    
excellent; the author of Google Code Prettify is also semi-active here as a user too: meta.stackoverflow.com/users/137403/mike-samuel –  Jeff Atwood Sep 1 '11 at 10:27

Not the answer you're looking for? Browse other questions tagged .