[Tutor] regex grouping/capturing

Oscar Benjamin oscar.j.benjamin at gmail.com
Tue Jun 18 12:42:44 CEST 2013


On 18 June 2013 09:27, Albert-Jan Roskam <fomcl at yahoo.com> wrote:
> from pygments.lexer import RegexLexer, bygroups from pygments.token import * class IniLexer(RegexLexer): name = 'INI' aliases = ['ini', 'cfg'] filenames = ['*.ini', '*.cfg'] tokens = { 'root': [ (r'\s+', Text), (r';.*?$', Comment), (r'\[.*?\]$', Keyword), (r'(.*?)(\s*)(=)(\s*)(.*?)$', bygroups(Name.Attribute, Text, Operator, Text, String)) ] }

I'm not sure how you sent this email but I'm assuming it wasn't
supposed to look like it does above. Did you compose/send this as
plain-text or html?


Oscar


More information about the Tutor mailing list