> Using a regex, I want to replace each leading space-character 
> with a corresponding zero-character on a one-to-one basis. 
> For an example
> string:
> 
> My $string = '     259.00 ';
> 
> Note that I don't want to change the trailing space 
> character. The resulting string would look like:
> 
> '00000259.00 '

How about

s/ (?=.*\d)/0/g;

Translation: any space with a digit to its right gets replaced with a
zero.

-- 
Mark Thomas 
Internet Systems Architect
_______________________________________
BAE SYSTEMS Information Technology 
2525 Network Place
Herndon, VA  20171  USA 


_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to