Thank you for your corrections. Yes, my function changes #, X and x because a template can be like thit 'DSF-###-####' and like that - 'XXX-XXXXXX-XXXX'<code>. <br>If number is <code>2345 and template is 'Ro-XXX-XXXXX-XXX'<code> result has to be <code>'Ro-000-00002-345'. I used regular expression for compactness of code.Thanks for interenting idea about /e modifier. I haven't known it. (I don't know a lot of things yet I think ;)) ). Michael