Re: Test string against expression?

Rick Miller <[email protected]> Mon, 17 Sep 2012 14:22:17 -0400
Newsgroups gmane.comp.python.cheetah
Message-ID <CAHzLAVHMfero-Sfk9cVnom2JemEtmozWggkbkRX=98mAGWSDaQ@mail.gmail.com>
On Mon, Sep 17, 2012 at 2:04 PM, Buck Golemon <[email protected]> wrote:
> Cheetah is a superset of python (kindof).
> Get your logic working in python, then port it to cheetah.
> You want re.match, from the standard python library:
>
> http://docs.python.org/library/re.html#re.RegexObject.match
>
>
> In your particular example below however, regular expressions are overkill,
> just use the string `in` operator:
>
> #if 'string' in $getVar('name')
>    #set foo = "bar"
> #else
>    #set bar = "foo"
> #end if
>
> That's basic python. You should take a couple hours and run through the
> official tutorial.
> At *least* skim the parts on string processing.
> http://docs.python.org/tutorial/

Thanks, Buck!  I'll check out that tutorial!

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/