'regex capture if not in a certain pattern
I am trying to write a regex to match numbers that ends with ' and are not in the pattern \d+\s*/\s*\d+'
x1 = "Better: 6 ' only"
x2 = """Better stain 15/16" 11/12\'"""
x3 = "14 / 16' 5' only"
x4 = "35' 14/15' better"
lst = [x1,x2,x3,x4]
expected output
x1 -> 6
x2 -> None
x3 -> 5
x4 -> 35
this is what I have so far (?<!\d/)(\d+\s*\')
Any help is appreciated
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
