Quote:
Originally Posted by
unknown123
then little change, try this:
try this:
my $str = " c1 ='mmdnn, , sdm = 'sm' ,m ,jkjk' , c2 = 'chj= kjk'' , khj ', c3='hhshhj, hsjh' ";
print "Before substitution-> $str\n";
$str =~ s/('[ ]*),([ ]*c)/$1:$2/g;
print "After substitution-> $str\n"; # Getting Wrong o/p
oh....! U took the advantage of 'c' here which is just an example..
ok let u give the real example whr i m facing the problem:
$sql=" UPDATE tab_nm SET string_nm =' 12th dec, 1984, 'op=1 ' ,s: 'g' ', name= ' Brian Hogg' , class = '1st, A.C: Field Pt. 0.1 ' WHERE HGR=24 ";
Actually I got the col_strings i.e:
$col_strings="string_nm =' 12th dec, 1984, 'op=1 ' , s: 'g' ', name= ' Brian Hogg' , class = '1st, A.C: Field Pt. 0.1 ' ";
Now I wanna substitute the
$col_strings as:
string_nm =' 12th dec, 1984, 'op=1 ' , s: 'g' '| name= ' Brian Hogg' | class = '1st, A.C: Field Pt. 0.1 '
That means I need the column informations in the string. And this string is as general as an sql strings containg columns like
$sql=" UPDATE tab_nm SET string_nm =' 12th dec, 1984, 'op=1 ' ,s: 'g' ', name= ' Brian Hogg' , class = '1st, A.C: Field Pt. 0.1 ' WHERE HGR=24 ";
Plz think for a very generalized way.. not specific like 'c'...
Plz help me to separate the columns & their values by substituting the commas with '|' which devides the columns information