[Tagging] Wiki Edit War on using/avoiding semicolon lists

Friedrich Volkmann bsd at volki.at
Wed Jan 21 03:13:51 UTC 2015


On 21.01.2015 02:51, Никита wrote:
> payment=efectivo;visa;mastercard;american␣express
> payment=mastercard;visa;efectivo
> 
> Now try to find *efectivo *with your regexes.

With a perl regex:
^[^=]+=(.*;)?\s*efectivo\s*(;.*)?$

Usually you only have the value in your variable, so you only need:
^(.*;)?\s*efectivo\s*(;.*)?$

But it's better programming style to split the values into arrays before you
work with them, like (in perl):
$_->{single_vals} = split /;/, $_->{compound_val} for keys @tags;

Then you need no regexp at all for your comparisons.

> How to query for "payment:efectivo"="yes"? I definitely need regex here.

You have to be aware of values like "1", "true", "unknown" etc.

-- 
Friedrich K. Volkmann       http://www.volki.at/
Adr.: Davidgasse 76-80/14/10, 1100 Wien, Austria



More information about the Tagging mailing list