« Return to Thread: Does Such A Tag Already Exist?

Re: Does Such A Tag Already Exist?

by Brad Lindsay-2 :: Rate this Message:

Reply to Author | View in Thread

On Jun 30, 2009, at 2:52 PM, Brad Lindsay wrote:
> Bil,
> This is awesome!  One quick question about your regular expression.  
> What does (?i) do?  Why are you starting everything with it?

Oh! Does it make the matching case-insensitive?

-Brad


>
> Also, I do want to modify this a bit further.  Once I'm done, is it  
> alright if I post it at tagSwap, or do you want to create a Lasso  
> Pro tag for it?
>
> Thanks,
> -Brad
>
> On Jun 30, 2009, at 2:36 PM, Bil Corry wrote:
>> Jason Huck wrote on 6/30/2009 12:58 PM:
>>> This would work with any order, but would need to be space-
>>> delimited:
>>
>> Building on yours, this makes the whitespace unimportant, the order  
>> is unimportant, extraneous text is unimportant, and only uses the  
>> first found instance of each time component:
>>
>> =========================================================
>> [
>>
>> define_tag('string_toduration', -req='in');
>> local('d' = 0, 'h' = 0, 'm' = 0, 's' = 0);
>> protect; #d = integer(string_findregexp(#in,-find='(?i)(\\d+)\
>> \s*d')->get(2)); /protect;
>> protect; #h = integer(string_findregexp(#in,-find='(?i)(\\d+)\
>> \s*h')->get(2)); /protect;
>> protect; #m = integer(string_findregexp(#in,-find='(?i)(\\d+)\
>> \s*m')->get(2)); /protect;
>> protect; #s = integer(string_findregexp(#in,-find='(?i)(\\d+)\
>> \s*s')->get(2)); /protect;
>> return(duration( -day=#d, -hour=#h, -minute=#m, -second=#s));
>> /define_tag;
>>
>> string_toduration('1d 17h 45m 22s');'<br>';
>> string_toduration('Duration is 17h 1 d45 m22s');'<br>';
>> string_toduration('Duration is 1 Day 17 Hours 45 Minutes and 22  
>> Seconds');'<br>';
>> string_toduration('17h 1 d45 m22s 0d0h0m0s');'<br>';
>> ]
>>
>> LP8:  41:45:22
>>     41:45:22
>>     41:45:22
>>     41:45:22
>> =========================================================
>>
>>
>> - Bil
>>
>>
>> --
>> This list is a free service of LassoSoft: http://www.LassoSoft.com/
>> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
>> Manage your subscription: http://www.ListSearch.com/Lasso/
>>
>>
>>
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>
>
>
>


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/


 « Return to Thread: Does Such A Tag Already Exist?