Pages: [1]
Author Topic: Add leading Zeros  (Read 482 times)
Posts: 16

« on: May 29, 2013, 12:11:58 PM »

Dear Dataminers,

I try to add leading zeros to the numbers within an attribut. Is there any way to do so?

I tried to find a regualr expression but couldn't find a solution Sad

Thank you for your time
Marius Helf
Hero Member
Posts: 1811

« Reply #1 on: May 29, 2013, 12:33:58 PM »

It's not thaaat easy, but it is possible. First of all, you have to convert the numerical attribute into a nominal attribute with Numerical to Polynominal. Then you have to create several regular expressions. For 3-digit values in the form:

^(\d)$ -> 00$1
^(\d\d)$ -> 0$1

The caret specifies that the expression must be matched at the beginning of the string, the dollar stands for the end of the string. Both together require an exact match.

Best regards,

Please add [SOLVED] to the topic title when your problem has been solved! (do so by editing the first post in the thread and modifying the title)
Please click here before posting.
Pages: [1]
Jump to: