tilmes
asked on
remove number in text
$fields[12] =~ s/\s+0\d+//g;
This works to remove th number begins with 0 in context.
However it does not work in the cases belows
TEL:040/72105730 : if some signs before 0, it dows not work
0998-20344 in this case
(040-2093494) In this case also?
Could you please make it work?
This works to remove th number begins with 0 in context.
However it does not work in the cases belows
TEL:040/72105730 : if some signs before 0, it dows not work
0998-20344 in this case
(040-2093494) In this case also?
Could you please make it work?
$fields[12] =~ s/\s+0[\d-\/]+//g;
the above one wont work, sorry
$fields[12] =~ s/\s+0[-\d\/]+//g;
$fields[12] =~ s/\s+0[-\d\/]+//g;
ASKER
Hello
it does not work. this Tel:0174 and Tel.0190 shows still in view
it does not work. this Tel:0174 and Tel.0190 shows still in view
ASKER
Can this work, if some signs before 0 wrote, for exmpale :0174
it shows still. Can remove all the numbers begins with 0
both either in case begins direct with 0 or some signs is already before 0?
it shows still. Can remove all the numbers begins with 0
both either in case begins direct with 0 or some signs is already before 0?
I'm a little leery of blindly removing leading zeroes, but if you define a leading zero as any one of a sequence of one or more zeroes that follow a nondigit and precede a digit, then maybe this regular expression substitution will do what you ask:
$fields[12] =~ s/(^|\D)0+(\d)/$1$2/g;
$fields[12] =~ s/(^|\D)0+(\d)/$1$2/g;
ASKER
This one removes only 0, the digit follows remained.
e.g. 04213444 becomes 4213444
e.g. 04213444 becomes 4213444
ASKER
Maybe it would be better if
the text begins with "Tel." or "Tel:" or "(0" remove following all digits.
and remove whole numbers begins with 0
the text begins with "Tel." or "Tel:" or "(0" remove following all digits.
and remove whole numbers begins with 0
ASKER
I am sorry,
It is firm if this works
remove all digits begins with 0
remove all digits include ":0" or ".0"
It is firm if this works
remove all digits begins with 0
remove all digits include ":0" or ".0"
Perhaps you need to start at the beginning. What is it you are trying to do? Please take the time to explain it clearly, since we are currently just making stabs in the dark.
another stab in the dark :-) If you want to delete only the prefix e.g. TEL:040/72105730 has to become TEL:72105730 you can use the following:
$fields[12]=~ s/(^|\D)0+\d*\D{0,1}(\d*)/ $1$2/g;
the outputs:
TEL:040/72105730 => TEL:72105730
0998-20344 => 20344
(040-2093494) => (2093494)
099820344 => (empty)
So according to jmcg's question: what is correct of these substitions and what isn't correct?
$fields[12]=~ s/(^|\D)0+\d*\D{0,1}(\d*)/
the outputs:
TEL:040/72105730 => TEL:72105730
0998-20344 => 20344
(040-2093494) => (2093494)
099820344 => (empty)
So according to jmcg's question: what is correct of these substitions and what isn't correct?
ASKER
can it be this way?
the outputs:
TEL:040/72105730 => TEL:(empty)
0998-20344 => (empty)
(040-2093494) => ((empty))
099820344 => (empty)
the outputs:
TEL:040/72105730 => TEL:(empty)
0998-20344 => (empty)
(040-2093494) => ((empty))
099820344 => (empty)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi BioI,
It works very good,
thanks again.
It works very good,
thanks again.
Hi Tilmes,
Nice that it works!
But do you sometimes consider to split points? Because in this case, I just proceeded the work of the experts above [in fact on the solution proposed by jmcg]. Maybe it's worth considering this next time...
CU around!
Nice that it works!
But do you sometimes consider to split points? Because in this case, I just proceeded the work of the experts above [in fact on the solution proposed by jmcg]. Maybe it's worth considering this next time...
CU around!
ASKER
Dear Bios
thanks for the advice. I know now how it works and it will be fair next time.
CU around!
thanks for the advice. I know now how it works and it will be fair next time.
CU around!