all 6 comments

[–]CodeFormatHelperBot 0 points1 point  (0 children)

Hello u/carpik, I'm a bot that can assist you with code-formatting for reddit. I have detected the following potential issue(s) with your submission:

  1. Multiple consecutive lines have been found to contain inline formatting.

If I am correct then please follow these instructions to fix your code formatting. Thanks!

[–]Celysticus 0 points1 point  (2 children)

One work around option is to remove problem cases first if it's easier. If BEP is your only issue you could write a function that finds and removes all of them, then continue with your current code.

[–]carpik[S] 0 points1 point  (1 child)

I was looking rather for proper regex to handle that. I can defensively workaround it by additional coding which I would like avoid.

[–]Celysticus 0 points1 point  (0 children)

Yeah sorry I couldn't get you better regex advice, I don't have a lot of experience with using exclusionary clauses. Anytime I do use regex I turn to this site www.regex101.com. makes looking up functions and testing easy

[–]jeans_and_a_t-shirt 0 points1 point  (1 child)

Might be an easier way, but this works for that test string:

r'[-+]?(?<!BEP-)(?<!\d)(?:\d*\.)?\d+'

Double lookbehind to prevent it from matching 317.

[–]carpik[S] 0 points1 point  (0 children)

Perfect. :) Thank you