Skip to content

Groups matching not working as expected #14

@vittot

Description

@vittot

If I have the following regex group:

Full_Date:
    Basic Full_Date:
        Expression: ([0-3]?[0-9]) \. ([0-1]?[0-9]) \. (20[0-9][0-9])
        Matches: 01.01.2021
        Non-Matches: 01--01-2021 | 01.01.1990
        Groups:
            - Day
            - Month
            - Year

and the following function, associated to Basic Full_Date:

def full_date(Day, Month, Year):
    print('full_date', Day, Month, Year)
    if Day is None or Month is None or Year is None or Day=='' or Month=='' or Year=='' or len(Day) > 2 or len(Month) > 2:
         return None
    if len(Day) == 1:
        Day = '0' + Day
    if len(Month) == 1:
        Month = '0' + Month
    return {'day':Day, 'month':Month, 'year':Year}

how is it possible that when parsing the string 21.2.2021 the function is called with Day= 21.2.2021, MOnth=21 and year=2 ? It does not make any sense to me

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions