[sr-dev] git:master: textopsx: added fnmatch(value, expr, flags) function

Daniel-Constantin Mierla miconda at gmail.com
Tue Dec 20 16:45:07 CET 2011


Hello,

On 12/20/11 12:15 PM, Juha Heinanen wrote:
> Daniel-Constantin Mierla writes:
>
>> +if(fnmatch("$rU", "123*"))
> daniel,
>
> would this be the same as starts_with("$rU", "123")?  if so, i suspect
> that starts_with would be even faster.
perhaps starts_with() is faster for this case.

>
> if i write
>
> if(fnmatch("$rU", "*123")) ...
>
> would match require that $rU ends with 123?
yes. Practically fnmatch uses the shell-like pattern matching, which is 
used for example with 'ls' command. You can have wildcards like * or ? 
at any position in the value, not only start or end. fnmatch is present 
as operator for quite long time in avpops/avp_check() and might be handy 
when needing to do such simple matching instead of using full regexp.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla -- http://www.asipto.com
http://linkedin.com/in/miconda -- http://twitter.com/miconda




More information about the sr-dev mailing list