Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^7: Faster regex to split a string into runs of similar characters?

by Eily (Monsignor)
on Nov 22, 2016 at 16:15 UTC ( [id://1176348]=note: print w/replies, xml ) Need Help??


in reply to Re^6: Faster regex to split a string into runs of similar characters?
in thread Faster regex to split a string into runs of similar characters?

For your data, using a null byte instead of a space would be importeant.

Actually that's why I chose /.\0*/gs instead of /[^\0]\0*/s. This means that the first character can be a 0, and every iteration after that it will never start with null because of the way regex work. Or technically, the idea crossed my mind, I realized it would still work by chance, and then forgot to mention it :)

Replies are listed 'Best First'.
Re^8: Faster regex to split a string into runs of similar characters?
by BrowserUk (Patriarch) on Nov 22, 2016 at 16:34 UTC
    Or technically, the idea crossed my mind, I realized it would still work by chance, and then forgot to mention it :)

    The significance went right over my head.

    But, I'm really impressed that vr picked up on it. It is so nice to see an OP applying their own thought processes to the posted code, rather than using it verbatim and then blaming us for not having considered every last nuance and detail of their problem, if it goes wrong.

    I really like your offset-and-xor technique. It is similar to a process I've used for edge detection in images in the past.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority". The enemy of (IT) success is complexity.
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-19 23:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found