[dba-VB] C# Regex?

Stuart McLachlan stuart at lexacorp.com.pg
Thu Mar 29 01:39:45 CDT 2012


Doesn't look like a case for Regex to me, you need to extract values, not just match strings.

I'd probably parse  the string into an array based on th space delimiter and the step through 
the array, mulitplying umeric values by 1, 60 or 3600 depending on what text is in the 
subsequent array element.


-- 
Stuart

On 29 Mar 2012 at 16:04, Michael Maddison wrote:

> Hi Guys,
> 
> Anyone good at regex?
> 
> My strings could look like any of these
> 	1 sec 
> 	11 sec
> 	1 min 5 sec
> 	1 min 26 sec
> 	1 hr  1 min 5 sec
> 	1 hr  12 min 26 sec	
> 
> The goal is to get total # of seconds but splitting into a
> MatchCollection would do.
> 
> Any takers?
> 
> Cheers
> 
> Michael M
> 
> _______________________________________________
> dba-VB mailing list
> dba-VB at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-vb
> http://www.databaseadvisors.com
> 
> 




More information about the dba-VB mailing list