regex.py 924 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
#
16 17
REG_COLLABORATION = r'^[A-Za-z0-9\-/, ]+([Cc]ollaboration|[Cc]onsortium|[Gg]roup)[s]?$'

18
# Valid Conference dates
19
#   - 3 Dec 2012
20 21 22
#   - 10-14 Dec 2012
#   - 28 Jun - 4 Jul 2012
#
23 24 25 26
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)
27

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

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