
rovf
Veteran
Jun 22, 2011, 4:51 AM
Post #2 of 7
(1679 views)
|
|
Re: [harshmane] how to split string without using split function
[In reply to]
|
Can't Post
|
|
not by using split function but by using simple Regex. The first argument to split *is* a regex. However, doing it without 'split' would go like this: Match your string on the pattern /(X)/g (note the g-modifier!) in list context. X is a pattern describing the fields you want to keep together. For example,
'xxabayyyybcbbbzz' =~ /([abc]+)/g evaluated in list context, yields the list ('aba','bcbb').
|