![]() |
Regex help
Hi all,
I need some help with a regular expression. I need to match entire Python functions; so, beginning with "(\W+)def .*(.*):" I need to math the following line, assuming it begins with more whitespace the first line, and any following lines that begin with the same amount of whitespace as that line. I am not worried about one-liners and other details right now, just what I described. Please help! I'm not even sure this is possible, but I hope it is. |
Re: Regex help
Try something like:
r"^\W*def .*\(.*\):.*\n(\W+).*(\n\1.*)*" Notes:
|
| All times are GMT -5. The time now is 3:15 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC