| |
Alain L
Posts: 1
Score: 0
Joined: 2/26/2004
From: Canada
Status: offline
|
Hi, It's my first stab at Regular Expressions and I haven't found an example yet showing how to replace pattern1 with pattern2, as in: pattern 1: \w{2};\d{2}-\d{2}-\d{4};\w{6,};\d{1,2};[0-9\-]+;[0-9\-]+;[0-9\.\-]+;[0-9\.\-]+ pattern 2: \(''\w{2}'',''\d{2}-\d{2}-\d{4}'',''\w{6,}'',\d{1,2},\d+,\d+,[0-9\.\-]+,[0-9\.\-]+\) string to replace: EU;30-07-2005;100000;97;31;904;-3.00;45.00 EU;30-07-2005;101405;28;1;2;0.1;0.1 EU;30-07-2005;101405;36;4;12;123;456 I can match pattern1, no problem, but I can't replace it with pattern2... The final string I'm trying to get is the following: ''EU'',''30-07-2005'',''100000'',97,31,904,-3.00,45.00 ''EU'',''30-07-2005'',''101405'',28,1,2,0.1,0.1 ''EU'',''30-07-2005'',''101405'',36,4,12,-123,456 (in other words, replace first three semicolon delimited fields by putting two apostrophes ('') at the begin and end of each field and replace all semicolons with commas) Can anybody help me with that? Any help would be very helpful... Thanks, Alain
|
|