Get the Digits From a String Before and After Special Character using regex
arrays, javascript, regex
Solution
JavaScript only keeps the last capture for `(...)+`, so you can write
var m = "5|10|20|200|300".match(/(\d+)(\|(\d+))+/);
Then `m[1]` is `"5"` and `m[3]` is `"300"`
Problem
I have a string like `5|10|20|200|300` and i want to get the First Digit Before `|` and last digit after `|` that is 5 and 300. How would I use regex in javascript to return that numbers??