Tuesday, 10 September 2013

Remove Last instance of a character and rest of a string

Remove Last instance of a character and rest of a string

I'm sure this is easy and I know I can use split, pop and join for this.
If I have a string as follows:
foo_bar_one_two_three
Is there a cleaner way w/ regex's to return: foo_bar_one_two?
Thanks

No comments:

Post a Comment