Solved

search and replace

Posted on 2002-06-01
2
198 Views
Last Modified: 2010-03-05
Hi:

I have a pattern like this

"1,885,5002,666,59026."

and i want to separate out as
"1,885,500"  "2,666,590" and "26."

basically it should split the 3 groups depending on
the property a comma can split a max of 3 chars.

right now I am searching for [0-9]\{4,9} which
highlights the 5002 and 59026 in the above example.

Can somebody please enlighten me how I can split it
into those 3 groups?

This above pattern is part of this string

A 26.37 1,885,5002,666,59026.1326.00 - 26.79
which is a stock price for the day.

Thanks
0
Comment
Question by:mbormann
2 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 100 total points
ID: 7048962
s/(\d{3})(?=\d)/$1 /g;
0
 
LVL 5

Author Comment

by:mbormann
ID: 8096967
Sorry I clean forgot about this one. Thanks for the answer!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question