python - Trouble in regular expression -
matching g in 'reference: g. ' using regular expression
i tried using error still occur
refresidue = re.compiler(r'(s/reference: \ //n)')
any other suggestions i'm quite new in this. appreciated.
'reference: g. ' reference can either a,c,g or t
i'm sorry confusion - have output prints out characters (a,c,g,t) instead of reference: .
this code
refresidue = re.compiler(r'(s/reference: \ //n)')
a_matchref = refresidue.search(row[2])
if a_matchref not none:
a_matchref = a_matchref.group(1)
you're mixing regex syntax javascript (or other regex flavor) , python; , regex quite strange. also, re.compile()
compiles regex, doesn't match anything.
assuming want match single alphanumeric character after text reference:
, try following:
refresidue = re.search(r"reference:\s*(\w)", your_text_to_be_matched).group(1)
Comments
Post a Comment