I need assistance with splitting a string by a specific character, such as a '/'. However, I also require the characters directly preceding the split character up to the space before them to be included in the result.
For instance:
let myStr =
"bob u/ used cars nr/ no resale value i/ information is attached to the vehicle tag bb/ Joe's wrecker service"
I can split by the '/' using
mySplitStr = myStr.split('/');
But the resulting array is like
mySplitStr[1] = "bob u"
mySplitStr[2] = " used cars nr"
mySplitStr[3] = " no resale value i"
etc
What I actually need is to extract the characters just before the '/'.
u
nr
i
etc
This information is crucial in determining how to handle data following the '/'.
Thank you for any help you can provide.