Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #7738

Composing regex from a list

From TheSaint <nobody@nowhere.net.no>
Newsgroups comp.lang.python
Subject Composing regex from a list
Followup-To comp.lang.python
Date 2011-06-16 20:48 +0800
Organization Aioe.org NNTP Server
Message-ID <itcu3f$b1k$1@speranza.aioe.org> (permalink)

Followups directed to: comp.lang.python

Show all headers | View raw


Hello,
Is it possible to compile a regex by supplying a list?

lst= ['good', 'brilliant'. 'solid']

re.compile(r'^'(any_of_lst))

without to go into a *for* cicle?

-- 
goto /dev/null

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Composing regex from a list TheSaint <nobody@nowhere.net.no> - 2011-06-16 20:48 +0800
  Re: Composing regex from a list Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-16 13:09 +0000
    Re: Composing regex from a list TheSaint <nobody@nowhere.net.no> - 2011-06-17 19:45 +0800
  Re: Composing regex from a list Vlastimil Brom <vlastimil.brom@gmail.com> - 2011-06-16 15:25 +0200

csiph-web