Reputation: 1275
I have mobile number series like this
9777358594
9861312901
8895210866
9861415461
9178146387
9853805726
9040663961
And I want replace them with this
a,9777358594
a,9861312901
a,8895210866
a,9861415461
a,9178146387
a,9853805726
a,9040663961
What is the regular expression to do this?
Upvotes: 1
Views: 8726
Reputation: 4012
If you are using vim, try:
%s/^\d\+/a,&/g
or simpler:
%s/^/a,/g
Upvotes: 0
Reputation: 26861
Won't that be much easier/cleaner with simpler string operations?
serial_no = sprintf('a,%s',serial_no);
Upvotes: 0
Reputation: 10174
The matching pattern should be ([0-9]+)
and replace pattern should be a,\1
.
If you are using a specific language (eg. PHP, JAVA etc.) it may slightly differ.
Upvotes: 1