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

Re: Simple way to split on last match?

by Anonymous Monk
on Aug 06, 2012 at 14:33 UTC ( #985739=note: print w/replies, xml ) Need Help??


in reply to Simple way to split on last match?

I like to use several regexes ... if you want the string at the end, $ will anchor to the end-of-string.   If you can't easily say it in one regex, use several.   If split() seems natural, just do it, then pop the result off the end.   In the long run it probably will not make the slightest bit of difference which way you do it, as long as it can be proved to work correctly with all possible inputs that it will encounter and if it is abundantly clear to the human eye.   (Literally... use Test::Most to construct a thorough test-case which will prove that the parsing algorithm you selected will always accept valid strings and will always reject invalid ones.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://985739]
help
Chatterbox?
[Corion]: It had been approved as a Perl Monks Discussion. It should now be approvable into SoPW
[choroba]: Approved
[LanX]: hmm aproval doesn't stick after move? Or was it a race condition
[Corion]: I think you need at least one reload after moving before you can approve in the correct section
[GotToBTru]: it was approved . but isnt now
[GotToBTru]: ah nevermind .. i was looking at one of 2
[GotToBTru]: SOPW version still shows approved by choroba

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (13)
As of 2017-01-16 15:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (151 votes). Check out past polls.