Page 1 of 1

RSS Python regular expressions help please

Posted: January 18th, 2010, 9:42 pm
by Turnip
Hi,
Trying to filter RSS say "12" and not wanting anything but that number, ie no E12 or S12 (I know I can use Reject for those).
How do I express the filter in Python? I have tried to get my head around it but cannot work it out, I get confused. I blame my age :-)
I know I need to start the filter with;  're:' but it's the what comes after that I stumble on, I can't seem to get the string right.  ???
Appreciate if I could get some help with this.

Cheers,
T

Re: RSS Python regular expressions help please

Posted: January 19th, 2010, 3:59 am
by shypike
If you want an isolated 12, like in "bla 12 bla", you could use this:

re:\D*12\D*

or

re: [^0-9]*12[^0-9]*

This means: zero or more non-digits, then "12", then zero or more non-digits.

Re: RSS Python regular expressions help please

Posted: January 19th, 2010, 5:08 am
by Turnip
Great,

Thanks heaps - I got it now! I was almost on the right track. Off to learn Python :-)

Cheers
T
:)

Re: RSS Python regular expressions help please

Posted: January 19th, 2010, 5:13 am
by shypike