Regex help

Dave Hodgkinson davehodg at gmail.com
Fri Apr 20 17:15:29 BST 2012


Or use a proper parser?

On 20 Apr 2012, at 16:41, Andy Armstrong wrote:

> On 20 Apr 2012, at 16:29, Simon Wistow wrote:
>>   ^
>>   (?::(\w+)      \s+)? # optional label
>>   ([A-Za-z]+)    \s+   # opcode
>>   ([^,\s]+) (?:, \s+   # operand
>>   ([^,\s]+))*    \s*   # optional second opcode
> 
> You don't get a distinct capture for each application of the pattern - so the third operand overwrites the second. Maybe put the * inside the parens and then parse the list of operands in a second step?
> 
> -- 
> Andy Armstrong, Hexten
> 
> 
> 
> 




More information about the london.pm mailing list