27.03.18 17:17, Ganesh Pal пише:
How do I split the below regex , so that it fits within the  character
limit of 79 words


pattern =  [
r'(?P<p_owner>([0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+::HEAD))',

r'(?P<a_owner>(owner:\s+[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+::HEAD))',
                 '.']

For example:

pattern =  [
r'(?P<p_owner>('
    r'[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:'
    r':HEAD))',
r'(?P<a_owner>(owner:\s+'
    r'[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:[0-9a-fA-F]+:'
    r':HEAD))',
'.']

Or just use fixed number repetition:

pattern =  [
    r'(?P<p_owner>((?:[0-9a-fA-F]+:){5}:HEAD))',
    r'(?P<a_owner>(owner:\s+(?:[0-9a-fA-F]+:){5}:HEAD))',
    '.']

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to