Syntax highlighting for regexp

We all now regular expressions can be difficult to read, but it seems to me like good syntax highlighting *within* a regexp would make the task much easier. Even something as simple as a different color for control characters vs literals. Is there an editor which does that?

Daniel

You can check out The Regex Coach [1] on Windows to help develop regular
expressions although it will not do syntax highlighting in your editor.

Dan

[1] The Regex Coach - interactive regular expressions

···

On Jan 13, 2008 12:12 AM, Daniel DeLorme <dan-ml@dan42.com> wrote:

We all now regular expressions can be difficult to read, but it seems to
me like good syntax highlighting *within* a regexp would make the task
much easier. Even something as simple as a different color for control
characters vs literals. Is there an editor which does that?

Daniel

Well... I find your English harder to read than my regexps. :stuck_out_tongue:

···

On Jan 12, 2008, at 21:12 , Daniel DeLorme wrote:

We all now regular expressions can be difficult to read

I do not know one off the top of my head but various editors allow to jump to matching brackets or highlight the expression between two matching brackets. There is also option /x which allows for nice regular expression formatting (including comments).

Kind regards

  robert

···

On 13.01.2008 06:12, Daniel DeLorme wrote:

We all now regular expressions can be difficult to read, but it seems to me like good syntax highlighting *within* a regexp would make the task much easier. Even something as simple as a different color for control characters vs literals. Is there an editor which does that?

tkregexp : A Tcl Tk is available by Laurent Riesterer (salut
Laurent !) :
   Visual REGEXP : a graphical explorer for your regexps
There is little difference between advanced tcl versus ruby regexp
syntaxe, so perhaps is a good candidate for a TkRuby application
exemple ?

PS. for those interested, there is a discution on the list:
    ruby-and-the-tk-tool-kit@googlegroups.com

-- Maurice

···

On Jan 13, 6:12 am, Daniel DeLorme <dan...@dan42.com> wrote:

We all now regular expressions can be difficult to read, but it seems to
me like good syntax highlighting *within* a regexp would make the task
much easier. Even something as simple as a different color for control
characters vs literals. Is there an editor which does that?

Daniel

Thanks for the answers but what I was looking for what really syntax highlighting within my editor, not a visual tool for building regex. I don't know if this is a common view, but I find regex are usually easier to write than to read.

After messing around a little, I managed to find how to hack jEdit's syntax highlighting for ruby, so I went and added what I wanted. I'm decently pleased with the results. I'm attaching the resulting syntax file, in case anyone is interested. Based on jEdit 4.2, it should replace the file /usr/share/jedit/modes/ruby.xml

Daniel

ruby.xml (19.2 KB)

Daniel-

  This is not exactly a regex syntax highlighter but it is one of the coolest regex tools I'v ever seen. It's an animated state machine chart based on regexes you paste in and you can see the state machine animate as it matches your string:

http://osteele.com/tools/reanimator/

Cheers-

- Ezra Zygmuntowicz
-- Founder & Software Architect
-- ezra@engineyard.com
-- EngineYard.com

···

On Jan 12, 2008, at 9:12 PM, Daniel DeLorme wrote:

We all now regular expressions can be difficult to read, but it seems to me like good syntax highlighting *within* a regexp would make the task much easier. Even something as simple as a different color for control characters vs literals. Is there an editor which does that?

Daniel