I have a string like this:
"8 R-301 288/313 0.24 TT-2079 347.48"
Now I want to extract 288/313 and 0.24 using regex So I wrote this:
r42=re.findall(r"8 +R-301.*",pdf[i])
if len(r42[0].split())>3:
print(r42[0].split())
logbook['R-301 Temp']=r42[0].split()[2]
logbook['R-301 P']=r42[0].split()[3]
So in an ideal case number comes in 2nd and 3rd index and I can get it.
But the problem I'm facing is that sometimes 288/313 has spaces like this 288 / 313, also the second number 0.24 can have a slash too so it can be like 0.24/0.25 or 0.24 /0.25. So the above regex doesn't work.
What would be an ideal regex for these decimal slash numbers with random spaces?
Note: The string can have multiple spaces between characters.
Edit:
Sorry I forgot one detail here:
numbers can have - like in the above example it can be -/313 instead of 288/313 or - instead of 0.24 or 0.24/- or -/0.24.
Something like this:
"8 R-301 288/- - TT-2079 347.48"
I want to target those cases as well.