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 10-04-2015, 05:23 AM   #16
ni_c
Enthusiast
ni_c began at the beginning.
 
Posts: 40
Karma: 10
Join Date: Jul 2015
Device: none
Btw, ive had a need to use escapes with some regex searches, and wondering if the way to describe escapes is like saying "treat the next character as plain text, rather than regular expression" because using (.*?) or (\d+) whenever square brackets are present like <span>[page (.*?)]</span> or <span>[page (\d+)]</span> doesnt work, but adding backslashes before each square bracket like <span>\[page (.*?)\]</span> does

Last edited by ni_c; 10-04-2015 at 06:53 AM.
ni_c is offline   Reply With Quote
Old 10-04-2015, 10:53 AM   #17
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,076
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by ni_c View Post
Btw, ive had a need to use escapes with some regex searches, and wondering if the way to describe escapes is like saying "treat the next character as plain text, rather than regular expression" because using (.*?) or (\d+) whenever square brackets are present like <span>[page (.*?)]</span> or <span>[page (\d+)]</span> doesnt work, but adding backslashes before each square bracket like <span>\[page (.*?)\]</span> does
any find TEXT character that has special meaning to REGEX needs to be escaped

[ ] is a 'set', ( ) is a group
dot, asterisk, question mark or slash

Grab yourself a 'Cheatography' REGEX Quick reference guide and keep it handy.
Just remember that not everything shown works will our REGEX variant.
theducks is offline   Reply With Quote
Advert
Old 10-04-2015, 11:39 AM   #18
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
@ni_c,

Correct. See: http://www.regular-expressions.info/characters.html


Brackets are special characters, which say "treat everything in between as a character set, and match on any".
Escaping with a backslash turns them into literal (plain old text) brackets.

Last edited by eschwartz; 10-04-2015 at 11:41 AM.
eschwartz is offline   Reply With Quote
Old 10-04-2015, 11:28 PM   #19
ni_c
Enthusiast
ni_c began at the beginning.
 
Posts: 40
Karma: 10
Join Date: Jul 2015
Device: none
thanks and thanks, that cheatography will help
ni_c is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Search and replace question (regular expression) Funslinger Library Management 2 06-21-2013 02:12 AM
Help with regular expression search/replace bfollowell Sigil 12 06-20-2013 07:36 PM
How to obtain a new page for every chapter in regular expression (search/replace)? Ravenik Conversion 2 05-24-2012 07:04 AM
Search & Replace - Regular expression oldbwl Calibre 2 01-09-2011 09:33 AM
Find/Replace with regular expression hydrolith Sigil 6 03-01-2010 08:42 PM


All times are GMT -4. The time now is 05:35 AM.


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