Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 11-30-2010, 06:02 PM   #1
gnychis
Junior Member
gnychis began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Nov 2010
Device: ipad
how to have regex dot match any character including newline?

Hi all,

I am trying to trim a footer that keeps mutating itself via the conversion process to include a variable number of characters and breaklines.

How can I setup my regular expression to have the dot character including any character which includes newline characters?

Thanks!
gnychis is offline   Reply With Quote
Old 11-30-2010, 06:09 PM   #2
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
put this at the very beginning of your regex:
Code:
(?s)
You can also use \s+ or \s* to wrap around a line feed.
ldolse is offline   Reply With Quote
Advert
Old 11-30-2010, 06:17 PM   #3
gnychis
Junior Member
gnychis began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Nov 2010
Device: ipad
thanks for the help!

hmmmm, this seems to be tricky... if I use (?s) all of my text gets selected :P

Here are two examples of what I'm trying to match:
Code:
<hr>
<A name=21></a><i><b>24_</b></i><br>
<i>ΤΖ.Κ. ΡΟΟΥΛΙΝΓΚ</i><br>
Code:
<hr>
<A name=265></a><i>268 ΤΖ. Κ. ΡΟΟΥΛΙΝΓΚ</i><br>
I have tried this regex, which successfully matches the latter but not the prior case
Code:
<hr>\s+.*ΡΟΟΥΛΙΝΓΚ.*<br>
gnychis is offline   Reply With Quote
Old 11-30-2010, 06:19 PM   #4
gnychis
Junior Member
gnychis began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Nov 2010
Device: ipad
this might be the winner:
Code:
<hr>\n+.*\n?.*ΡΟΟΥΛΙΝΓΚ.*<br>
gnychis is offline   Reply With Quote
Old 11-30-2010, 06:22 PM   #5
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
Probably best not to use .* - it's way too greedy. Try .*? instead. Even that can sometimes have unintended matches, so be sure to review the whole book's matches.
ldolse is offline   Reply With Quote
Advert
Old 11-30-2010, 06:35 PM   #6
gnychis
Junior Member
gnychis began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Nov 2010
Device: ipad
thanks bud! got it worked out
gnychis is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dot on my kindle (International)? ensyed Amazon Kindle 5 12-17-2010 01:33 PM
regex for character replacement, em-dash questions cybmole Calibre 3 10-18-2010 03:09 PM
Need help with a conversion regex - can't match newline ereader123 Calibre 2 03-29-2010 10:58 AM
Old news: Sony PRS-505 wins international red dot design award - 2008 Wetdogeared News 0 06-20-2009 09:51 AM
Microsoft's latest stunt: On 10 dot net Alexander Turcic Lounge 0 03-13-2006 08:06 AM


All times are GMT -4. The time now is 07:16 PM.


MobileRead.com is a privately owned, operated and funded community.