List:General Discussion« Previous MessageNext Message »
From:Ravi Kumar. Date:September 29 2006 9:25am
Subject:Regular Exp help
View as plain text  
Dear All,
 
I have a table with a varchar column that stores data in this pattern: 
 
<number><one_white_space><string><one_white_space><hyphen_symbol>
 
The pattern may be repeated upto 5 times in same cell, but the string will
be different in each case. Hence there will not be a value like this:
1 BW - 2.5 BW -
 
1 WT -	
1 BW - 1 ME -	
1 BW - 1 ME - 1.5 SY -	
1 BW -	
1 WT -	
1 OT - 2.5 WE -	
1 OT - 1 SY -	
1 WT -	
1 IT - 1 OT -	
 
I need a regular exp or any other query to fetch sum of numbers before a
string. For example the result should be 2.5 if I am searching for SY and 3
if I am searching for WT.
 
I tried a bit, but could not succeed. I am using 4.1.14-standard-log. 
 
The table is huge, hence the query should be streamlined enough.
 
Please help.
 
Thanks,
 
Ravi.

Thread
Regular Exp helpRavi Kumar.29 Sep
  • Re: Regular Exp helpPhilip Mather29 Sep