Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
go ahead... be a heretic

Re^3: Efficient walk/iterate along a string

by Anonymous Monk
on Dec 01, 2010 at 06:26 UTC ( #874610=note: print w/ replies, xml ) Need Help??

in reply to Re^2: Efficient walk/iterate along a string
in thread Efficient walk/iterate along a string


Hope I've got the techno details and the "protocol" right here.

I replied to your repy on my main thread as below. Appreciate if you could elucidate (love that word!) the regexp as per my words below. Various explorations with variants on ?<= give me the protein string split on the KR characters, with or without null strings, strings of just K or R, strings where consective K/R were condensed to just one, or none. I'm sure I can work it out with about 5 hours of exploration, but if you could just put into words what the ?<= is doibg I'd ber grateful.

Thanks, GE.

Cheers, GE


I tried the split/tr/map approach suggested by Grandfather and got ~ 60% reduction in time, great ! (and yes you got my app requirement exactly right)

I think should withdraw my words that there's nothing to be gained from the special functions when you're just marching down strings and doing a seemingly arbitrary logic function (and also my words about inadequate context). Splitting at simple marker points and counting a simple set of chars within the splits, combined with Perl's superb list handling, is not arbitrary spaghetti logic. Lesson learned.

One query: the ?<= construct was new to me, I've played with it and read up on it (perlre/Extended Patterns/Look-Around Assertions) and I'm 80% there but if anyone could explain exactly how this RE is ensuring I get exactly what I need I'd be grateful.

Will continue to check some other posts, thanks all


20101206 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips

Comment on Re^3: Efficient walk/iterate along a string
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://874610]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2014-04-21 04:44 GMT
Find Nodes?
    Voting Booth?

    April first is:

    Results (490 votes), past polls