regex.py 930 Bytes
Newer Older
1
# *-* coding: utf-8 *-*
2 3
""" A collections of regular expression defining rules validating
fields content.
4 5 6 7

@author: R. Le Gac

"""
8
# Valid Collaboration field:
9 10 11
#  - CMS Collaboration
#  - CMS and LHCb Collaborations
#  - ATLAS Collaboration, CMS Collaboration
12
#  - Heavy Flavour Averaging Group
13 14 15
#  - CTA Consortium
#  - any mixture of the above separated by a comma
#
LE GAC Renaud's avatar
LE GAC Renaud committed
16 17
REG_COLLABORATION = \
    r'^[A-Za-z0-9\-/, ]+([Cc]ollaboration|[Cc]onsortium|[Gg]roup)[s]?$'
18

19
# Valid Conference dates
20
#   - 3 Dec 2012
21 22 23
#   - 10-14 Dec 2012
#   - 28 Jun - 4 Jul 2012
#
24 25 26 27
reg1 = r'\d{1,2} [A-Z][a-z]{2} \d{4}'
reg2 = r'\d{1,2}-\d{1,2} [A-Z][a-z]{2} \d{4}'
reg3 = r'\d{1,2} [A-Z][a-z]{2} - \d{1,2} [A-Z][a-z]{2} \d{4}'
REG_CONF_DATES = r'%s|%s|%s' % (reg1, reg2, reg3)
28

29
# Valid Defence date
30 31 32 33
#  - 30 Dec 2012
#
REG_DEFENSE = r'\d{2} [A-Z][a-z]{2} \d{4}'

34
# Valid Submitted field
35 36
#  - 2012-12
#  - 2012-12-31
37
#
38
REG_SUBMITTED = r'\d{4}-\d{2}(-\d{2})?'