gawseed/algorithm/generic_ext.py
def re_match_both( item, args ):
    """Matches a regex with a group (argument 2) against the column (number in argument 1)"""
    import re

    # setup
    (re_col1, re_expr1, re_col2, re_expr2 ) = args
    if re_expr1 not in compiled_res:
        compiled_res[re_expr1] = re.compile(re_expr1)
    if re_expr2 not in compiled_res:
        compiled_res[re_expr2] = re.compile(re_expr2)

    # test if a match occurred
    match1 = compiled_res[re_expr1].search(item[re_col1])
    match2 = compiled_res[re_expr2].search(item[re_col2])
    if match1 and match2:
        return ["%s-%s" % (match1.group(1), match2.group(1)), '']
    return ['', '']
Matches a regex with a group (argument 2) against the column (number in argument 1)
Matches a regex with a group (argument 2) against the column (number in argument 1)
Matches a regex with a group ( argument 2 ) against the column ( number in argument 1 )
def re_match_both( item, args ):
    import re
    (re_col1, re_expr1, re_col2, re_expr2 ) = args
    if re_expr1 not in compiled_res:
        compiled_res[re_expr1] = re.compile(re_expr1)
    if re_expr2 not in compiled_res:
        compiled_res[re_expr2] = re.compile(re_expr2)
    match1 = compiled_res[re_expr1].search(item[re_col1])
    match2 = compiled_res[re_expr2].search(item[re_col2])
    if match1 and match2:
        return ["%s-%s" % (match1.group(1), match2.group(1)), '']
    return ['', '']
def re_match_both ( item , args ) : import re ( re_col1 , re_expr1 , re_col2 , re_expr2 ) = args if re_expr1 not in compiled_res : compiled_res [ re_expr1 ] = re . compile ( re_expr1 ) if re_expr2 not in compiled_res : compiled_res [ re_expr2 ] = re . compile ( re_expr2 ) match1 = compiled_res [ re_expr1 ] . search ( item [ re_col1 ] ) match2 = compiled_res [ re_expr2 ] . search ( item [ re_col2 ] ) if match1 and match2 : return [ "%s-%s" % ( match1 . group ( 1 ) , match2 . group ( 1 ) ) , '' ] return [ '' , '' ]
Matches a regex with a group (argument 2) against the column (number in argument 1)
Matches a regex with a group ( argument 2 ) against the column ( number in argument 1 )
"""Matches a regex with a group (argument 2) against the column (number in argument 1)""" # setup # test if a match occurred
item
args