RegEx for getting the first number before the first slash
Hello! I need a RegExp to get the first number before the first slash in a string. I've been banging my head against this for a while... and failing.
For the substring before the slash, I've got (^[^\/]+). And for the last number in that substring I've got... not much. I've been hitting it with combinations of $ and \d but nothing's working.
The strings will be formed like these;
- 1 / something / something else / ...
~ 2 / another something / something else / ... / ...
- 3-4 / thing / ...
-~ 5-6 / ... / ... / ... / ... / ...
In each case, I want the number imediately to the left of the first slash. So from the above examples I want 1, 2, 4 and 6 respectively.
Someday I'll understand RegEx... but not today, it seems. Please help!
