Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Qns on blank lines

Thread Tools

Qns on blank lines
Posts: n/a

i have some regular exp code in perl that i want to convert to python.

if $line =~ m#<(tag1)>(.*)</\1>#
$variable = $2;

the perl code finds a line that matches something like

"<tag1>sometext<\tag1>" in the line and then assign $variable the value
of "sometext"

how can i do an equivalent of that using re module?

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Preserve blank lines when add multiple lines of text to a cell Cah Sableng Javascript 0 04-23-2007 04:46 AM
T'Bird Address Book Qns Dennis J. Tuchler Firefox 3 07-28-2005 12:24 AM
2 Qns re Thunderbird Dennis J. Tuchler Firefox 7 12-23-2004 10:26 PM
2 very basic qns mescaline C++ 5 12-29-2003 02:51 PM
Misc Qns... Jin C Programming 20 12-25-2003 01:45 AM