I don\'t want to use string split because I have numbers 1-99, and a column of string that contain \'#/#\' somewhere in the text.
How can I write a regex to extract the
Find all numbers before the forward-slash and exclude the forward-slash by using start-stop parentheses.
>>> import re
>>> myString = 'He got 10/19 questions right.'
>>> stringNumber = re.findall('([0-9]+)/', myString)
>>> stringNumber
['10']
This returns all numbers ended with a forward-slash, but in a list of strings. if you want integers, you should map your list with int, then make a list again.
>>> intNumber = list(map(int, stringNumber))
>>> intNumber
[10]