siskos1 has asked for the wisdom of the Perl Monks concerning the following question:
hi. my problem is i forgot how to embed code in regex and for this particular problem i am now clueless
i couldn't do it even after i searched a lot today for hours. i want to count some characters in a string. then after a threshold, i want to save the place. for example; let my string be: "abacdbccdee". i want to count total of 3, c's and b's. (order or how many of each one is not important) so at 6th place, i count 2b's and 1c. only thing i want in this puzzle is 6
i can do it if i split string into array but if i dont remember wrong, regular expression is more efficient. and this my another concern, considering i will search big strings, is there a way to stop regular expression after i found the place. no need to look for rest
thank you in advance
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: a regular expression problem
by moritz (Cardinal) on Feb 29, 2012 at 16:03 UTC | |
by siskos1 (Acolyte) on Feb 29, 2012 at 16:10 UTC | |
|
Re: a regular expression problem
by Eliya (Vicar) on Feb 29, 2012 at 16:27 UTC | |
|
Re: a regular expression problem
by AnomalousMonk (Archbishop) on Feb 29, 2012 at 17:32 UTC | |
|
Re: a regular expression problem
by ww (Archbishop) on Feb 29, 2012 at 16:14 UTC | |
by siskos1 (Acolyte) on Feb 29, 2012 at 16:53 UTC | |
|