View Single Post
Old 04-26-2010, 05:48 AM   #4
prky
Member
prky began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Nov 2009
Device: IPhone 3GS
Okay, so I can make .* match across newlines by using the s flag.

And I can test it in python to confirm it works, but it doesn't work in calibre.

If I go to http://www.pythonregex.com/ and put in the regex as:

Code:
(?mis)Order your copy.*?Ancestor ~ Scott Sigler.*?$
and the String as:

Code:
Pearcy pointed to another phone, this one built into the equipment-thick control panel. </p><p>
Order your copy from Amazon.com on April 1: Noon Eastern Time, 9AM Pacicific</p><p>
<a href="http://www.amazon.com/Ancestor-Scott-Sigler/dp/1896944736">http://www.amazon.com/Ancestor-Scott-Sigler/dp/1896944736</a></p><p>
Ancestor ~ Scott Sigler</p><p>
“That’s a straight line to Langley. Just pick it up and it will ring through.” </p><p>
Then that regex tester reports that it's found:

Code:
# Run findall
>>> regex.findall(string)
[u'Order your copy from Amazon.com on April 1: Noon Eastern Time, 9AM Pacicific</p><p>\r\n<a href="http://www.amazon.com/Ancestor-Scott-Sigler/dp/1896944736">http://www.amazon.com/Ancestor-Scott-Sigler/dp/1896944736</a></p><p>\r\nAncestor ~ Scott Sigler</p><p>\r']
That's what I want it to match - so it looks like we're in business.

Except...

When I paste that exact same regex into the calibre regex builder, it doesn't highlight anything

*tears more hair out*

prk.
prky is offline   Reply With Quote