Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 05-04-2014, 12:37 AM   #1
user743
Addict
user743 has never been to obedience school.user743 has never been to obedience school.user743 has never been to obedience school.user743 has never been to obedience school.user743 has never been to obedience school.user743 has never been to obedience school.user743 has never been to obedience school.user743 has never been to obedience school.user743 has never been to obedience school.user743 has never been to obedience school.user743 has never been to obedience school.
 
Posts: 243
Karma: 44444
Join Date: Mar 2014
Device: Kindle PW2 special offers removed by Amazon for FREE
regex "?" with higher priority greedynes then the previous "?" ?

I'm trying to make a regex to add <body>, </body> and </html> tags, wherever they are missing.

maybe this will work.
Code:
(</head>\s*)(<body>)?([^(</(body|html)>)]+).*
replace with
Code:
\1<body>\3</body></html>
is there a simpler and more reliable regex, like
Code:
(</head>\s*)(<body>)?(.+)(</body>)?^^extra greedy^^\s?(</html>)?^^extra greedy^^
replace with
Code:
\1<body>\3</body></html>
to give one "?" first priority to be greedy, before a previous "?".

edit
is at least the first regex valid and reliable?

Last edited by user743; 05-10-2014 at 10:50 PM.
user743 is offline   Reply With Quote
Old 05-04-2014, 03:57 AM   #2
JLius
Village idiot
JLius ought to be getting tired of karma fortunes by now.JLius ought to be getting tired of karma fortunes by now.JLius ought to be getting tired of karma fortunes by now.JLius ought to be getting tired of karma fortunes by now.JLius ought to be getting tired of karma fortunes by now.JLius ought to be getting tired of karma fortunes by now.JLius ought to be getting tired of karma fortunes by now.JLius ought to be getting tired of karma fortunes by now.JLius ought to be getting tired of karma fortunes by now.JLius ought to be getting tired of karma fortunes by now.JLius ought to be getting tired of karma fortunes by now.
 
JLius's Avatar
 
Posts: 157
Karma: 519566
Join Date: Mar 2014
Location: Belgium
Device: sony PRS T-1
Just use beautify, it will add <body> and <html> ( and /) when missing.
JLius is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Old Thread] Regex "FN LN" to "LN, FN" & reverse? unboggling Library Management 19 11-20-2013 06:44 AM
Feature Request: configurable space setting for "Insert blank line" in "Look & Feel" therealjoeblow Calibre 15 07-25-2011 03:14 PM
Seriously thoughtful "Higher Education: How Colleges are Wasting our Money" MartinParish Lounge 29 08-31-2010 10:13 AM


All times are GMT -4. The time now is 04:18 AM.


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