Relative Content

Tag Archive for pythonregexpython-re

Get Regex to return just the wildcards in a string

I have tried the below example that I found on here (Python extract pattern matches) and it works perfectly. However, my actual code also below returns the wildcard part of the string plus the rest of the string that occurs after the wildcard. I don’t see what I am doing differently.

Regular Expression cannot find the match although it exists

I am trying to write a function that finds the name and positions of a gene that is in a small text. I am using the name of the gene and its possible synonyms. When testing the function on one of the texts, I get an error that the list of my matches is empty but the text actually contains a gene.