1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Python regex ignoring pattern

Discussão em 'Python' iniciado por Stack, Julho 13, 2025.

  1. Stack

    Stack Membro Participativo

    I have a list of two keywords like below:

    keywords = ["Azure", "Azure cloud"]


    but python unable to find the second keyword "Azure cloud"

    >>> keywords = ["Azure", "Azure cloud"]
    >>> r = re.compile('|'.join([re.escape(w) for w in keywords]), flags=re.I)
    >>> word = "Azure and Azure cloud"
    >>> r.findall(word)
    ['Azure', 'Azure']


    I am expecting the output like this : ['Azure', 'Azure', 'Azure cloud']

    Any guide/help would be highly appreciated!

    Continue reading...

Compartilhe esta Página