[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: a simple command that splits up a string into numbers and letters

Dan Diebolt

2/5/2009 6:47:00 AM

[Note: parts of this message were removed to make it a legal post.]

I got it on the first try with this split!

irb> '34JKBY103dfd878dsf78s78s'.split(/([a-zA-Z]+)(?=[0-9])/)
=> ["34", "JKBY", "103", "dfd", "878", "dsf", "78", "s", "78s"]

the first set of parens is capturing while the second set of parents is a zero width positive look ahead


1 Answer

shawn bright

2/5/2009 7:02:00 AM

0

[Note: parts of this message were removed to make it a legal post.]

way cool, thanks, all
-sk


On Thu, Feb 5, 2009 at 12:46 AM, DanDiebolt.exe <dandiebolt@yahoo.com>wrote:

> I got it on the first try with this split!
>
> irb> '34JKBY103dfd878dsf78s78s'.split(/([a-zA-Z]+)(?=[0-9])/)
> => ["34", "JKBY", "103", "dfd", "878", "dsf", "78", "s", "78s"]
>
> the first set of parens is capturing while the second set of parents is a
> zero width positive look ahead
>
>