On Thu, Nov 18, 2010 at 12:52 PM, Jeff C. Britton <[email protected]> wrote:
> I have a string that I want to match against a regular expression.
> However, group capture is not supported :(
Here's an approach using peg.ebnf. You'll also need math.parser for
'string>number' and peg for 'ignore'.
EBNF: parse-line
digits = [0-9]+ => [[ >string string>number ]]
part1 = digits:a ":" digits:b => [[ { a b } ]]
ws = " " | "\t"
, = "," => [[ drop ignore ]]
any6 = . . . . . . => [[ >string ]]
part2 = "approach" | "detect"
part3 = "any" | "down"
part4 = "presence" | "extension" | "delay" | "pulse" | "etc"
line = part1 ws* , any6 , part2 , part3 , part4 ,
digits , digits , digits , digits ,
"presence" , digits , "presence" , digits
;EBNF
"1:0,z1 ,approach,any,presence,0,1,1,0,presence,0,presence,0" parse-line
Chris.
--
http://www.bluishcoder.co.nz
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk