Regular Expression Finding the Space before the Last word

regex, sublimetext2

Solution

[ ](?=[^ ]+$)

You can try this.Replace by `,`.See demo.

https://regex101.com/r/oL9kE8/17

Problem

I'm trying to find the space before the last word of a string. For example, for ``` Bob Jane ``` I would want to find the space right before Jane. I am trying to do a find and replace all to make that become a comma. Thus, the final result would be ``` Bob ,Jane ``` I'm only doing this in a text editor (using Sublime) so I'm not using a programming language. Thank you!

Original source