regular expressions help
Chris Angelico
rosuav at gmail.com
Thu Sep 19 14:17:16 EDT 2019
On Fri, Sep 20, 2019 at 1:07 AM Pradeep Patra <smilesonisamal at gmail.com> wrote:
>
> Thanks David /Anthony for your help. I figured out the issue myself. I
> dont need any ^, $ etc to the regex pattern and the plain string (for exp
> my-dog) works fine. I am looking at creating a generic method so that
> instead of passing my-dog i can pass my-cat or blah blah. I am thinking of
> creating a list of probable combinations to search from the list. Anybody
> have better ideas?
>
If you just want to find a string in another string, don't use regular
expressions at all! Just ask Python directly:
>>> print("my-cat" in "This is where you can find my-cat, look, see!")
True
ChrisA
More information about the Python-list
mailing list