I have the following string
line = "1234567 7852853427.111 https://en.wikipedia.org/wiki/Dictionary_(disambiguation)"
I would like to remove the numbers 1234567 7852853427.111 using regular expresisions
I have this re
nline = re.sub("^\d+\s|\s\d+\s|\s\d\w\d|\s\d+$", " ", line)
but it is not doing what i hoped it would be doing.
Can anyone point me in the right direction?
|split the entire regex into distinct parts - that is, the first part matches the start of the string but the second one does not. You may want to read up on creating groups with parentheses.http://"? Your title mentions punctuation - should1..2at the beginning be removed?line.split()[-1], which is much easier.