Python, as you probably know, has the feature for matching 
subexpressions in a regular expression, like this:

 >>> m = re.search(r'((\w+):(.*))', 'host:/foo/bar/baz')
 >>> m.groups()
('host:/foo/bar/baz', 'host', '/foo/bar/baz')

or:

 >>> m = re.search(r'(?P<arg>(?P<host>\w+):(?P<path>.*))', 
'host:/foo/bar/baz')
 >>> m.groups('host')
'host'
 >>> m.groups('path')
'/foo/bar/baz'
 >>> m.groups('arg')
'host:/foo/bar/baz'

I don't see an easy way on how to do this. reglex seems like it could 
work, or using the glr parser, but that seems a little heavyweight. How 
difficult would it be to support something like this?

regmatch "host:/foo/bar/baz" with
| ((alphanumeric+ as ?host) ":" (_* as ?path)) as ?arg => Some (arg, 
host, port)
| _ => None
endregmatch;

-e

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to