0

So I have a number substring that appears twice in my program that looks like this 00'00"000.

I was originally using the regular expression:

\d{2}\'\d{2}\"\d{3}

and it was working for a few days but now for some reason, it's not? Python's re library isn't finding these substrings at all anymore. What am I doing wrong here?

Code In question:

    elif message.content.startswith('%timegap'):
    if message.content == '%timegap -h':
        await client.send_message(message.channel,
                                  '```' + 'Usage: %timegap [time 1] [time 2]\n' + \
                                  """Example: %timegap 03'29"110 03'28"390""" + '```')
    else:
        time_list = re.findall("\d*\'\d+\"\d+", message.content)
        await client.send_message(message.channel, calculate_time_gap(time_list))
Zero
  • 3
  • 3

1 Answers1

0

The quotes from your strings are not the same as the ones in your regex:

re.findall(r'\d{2}\’\d{2}\”\d{3}', '%timegap 03’14”800 03’14”800')
> ['03’14”800', '03’14”800']
Paco H.
  • 2,034
  • 7
  • 18
  • I was unaware that there were different quotes. I assume a phone would give a different quote so now I have to check for either or. Thank you so much, I appreciate the help. – Zero Sep 29 '17 at 08:24