Support forum
'regex:^0+replace:' is the correct regular expression to remove all leading zeros from a string.
If this does not work in your configuration I would like to see the configuration file of Diafaan SM Server (menu options 'File-Export-Configuration). You can send the file to email address dms@diafaan.com.
Regards, Henk
10:34 am
regex:^0+replace:
i tested. no just leading zeros but all zero are removed.
eg.
0010999 -> 1999
Hello Peter,
To remove two leading zeros from the number:
regex:^00replace:
To change two leading zeros to a '+':
regex:^00replace:+
To remove all leading zeros from the number:
regex:^0+replace:
Regards, Henk
5:23 pm
if no of digits following 0 varies, eg
004491239123 -> 4491239123
00618123812333 -> 618123812333
how to achieve using regex?
12:09 am
Ok resolved this with
regex:[^\d]replace:template:640[64]########;640[64]#########;640[64]##########;640[64]###########
11:51 pm
Hi Henk,
I tried your example but messages still didnt send. I have added this
:template:0[+64]########;0[+64]#########;0[+64]##########;0[+64]###########
to the gateway and the number shows in the log as +64 027 123 1234. Presumably the above translation is converting to +64271231234 but nothing came through.
Many thanks
paul
You can add a (list of) normal number template(s) after the regular expression to change the number format further, e.g.:
regex:[^\d]replace:template:0[+44]#########;0[+44]##########
This template first strips the number of all non-digits with the regex/replace combination and then replaces the leading 0 with +44 for any numbers that have 10 or 11 digits with the two normal number templates at the end.
It is probably possible to do this with a single regex/replace combination as well but that requires more skills than I possess on regular expressions.
Regards, Henk
12:23 am
Hi there we have set up the server with a gateway and the following number template:
regex:[^\d]replace:
However, sometimes the user also enters the leading 0 so we end up with +countrycode 0 number
How can we ensure that 0 is removed because it causes chaos with the gateway?
Many thanks
Most Users Ever Online: 529
Currently Online:
36 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Member Stats:
Guest Posters: 672
Members: 0
Moderators: 0
Admins: 1
Forum Stats:
Groups: 2
Forums: 3
Topics: 1141
Posts: 3899
Newest Members:
, Henk HelmantelAdministrators: Henk Helmantel: 1488