Angus Leeming wrote:

> Georg Baum wrote:
>> It seems that boost::regex is greedy, so I had to readd the "[^,]" part.
>> Because of that, the "?" is also needed, but the second and third group
>> are indeed unnecessary, so I have now
>> 
>>                  back("^(.*[^,])?,*[]] *$");
>> 
>> This will go in tomorrow unless you find something that is still wrong.
> 
> Very interesting. Thanks, Georg. One refinement:
> 
>                  back("^(.*[^,]?),*[]] *$");
> 
> You're interested in
>         zero or more of any character followed by
>         zero or one 'not commas' followed by
>         zero or more commas followed by
>         the ] character
> not
>         zero or one of
>                 zero or more of any character followed by
>                 a 'not comma'
>         followed by
>         zero or more commas followed by
>         the ] character
> 
> At least, I think you are ;-)

I am not ;-) Your refinement does not catch trailing commas as in [a,],
because ".*" matches "a,", and then "[^,]?" and ",*" match the empty
string.


Georg

Reply via email to