c**t 发帖数: 2744 | 1 $s = '7/1/2007 1:20,field 2,6/9/2006 2:9,field 3,1/1/2008 12:9';
try to convert it to
'07/01/2007 01:20,field 2,06/09/2006 02:09,field 3,01/01/2008 12:09'
how to write reguler expression to replace?
$x =~ s![^01-9]?(\d)([/:]+)!0$1$2!g; # removed , and empty space
~
~ | c**t 发帖数: 2744 | 2 $x =~ s!([^0-9]?[1-9])([/:,]+)!0$1$2!g; #doesn't work either
【在 c**t 的大作中提到】 : $s = '7/1/2007 1:20,field 2,6/9/2006 2:9,field 3,1/1/2008 12:9'; : try to convert it to : '07/01/2007 01:20,field 2,06/09/2006 02:09,field 3,01/01/2008 12:09' : how to write reguler expression to replace? : $x =~ s![^01-9]?(\d)([/:]+)!0$1$2!g; # removed , and empty space : ~ : ~
| c**t 发帖数: 2744 | 3 thanks, ${1} is the key!! | c**t 发帖数: 2744 | 4 maybe using replace multiple times.. | c**t 发帖数: 2744 | |
|