sabreW4K3@lazysoci.al to RegEx@programming.dev · 2 个月前Why won't this work?lazysoci.alimagemessage-square12linkfedilinkarrow-up19arrow-down10file-text
arrow-up19arrow-down1imageWhy won't this work?lazysoci.alsabreW4K3@lazysoci.al to RegEx@programming.dev · 2 个月前message-square12linkfedilinkfile-text
(?<!\d)\d+\.\d+ should match the numbers at the end of the lines and yet it won’t. What am I doing wrong?
minus-squarea14o@feddit.orglinkfedilinkarrow-up5·2 个月前 surround the “\d+.” with a question mark group? If you’re expecting decimals, that’s the preferred solution: (?<!\d)(\d+\.)?\d+(?=\s*$) Otherwise you could do simply (?<!\d)\d+(?=\s*$) I added the lookahead (?=\s*$) to match digits at the end of the line only with possible trailing spaces.
If you’re expecting decimals, that’s the preferred solution:
(?<!\d)(\d+\.)?\d+(?=\s*$)
Otherwise you could do simply
(?<!\d)\d+(?=\s*$)
I added the lookahead
(?=\s*$)
to match digits at the end of the line only with possible trailing spaces.Whaaaaaaa, thank you!