Extract Pattern Wrong Pattern?

Status: Open · Asked by elonmusk on · 0 views

elonmusk — Question ·

hello,

i have a series of number as follow:
00004101
00023489
00134939

I would like to remove all leading zeros.
i have tried this \b0*([1-9][0-9]*)\b
but it doesnt work.

can somebody help?

thanks

Arshil Ahmad — Reply ·

Please try using Code by Pabbly to run this Python code, which will help you remove the leading zeros.

import re

input_string = "0000007856560"
output_string = re.sub(r'^0+', '', input_string)
print(output_string)

Back to all forum threads · Log in to reply