Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 02-07-2019, 01:12 PM   #1
mavaddat
Junior Member
mavaddat began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Mar 2018
Location: Vancouver, BC
Device: Kindle Voyage
Question Is regex available in Sigil clip editor?

I see that the Sigil Clip Editor has some basic regex (e.g., the first numbered group
Code:
\1
matches the entire selected text in the replace text and
Code:
\U
recalls the text with the entire selected text in uppercase), but I don't see any specification of the syntax for the Clip Editor. Does anyone know what the full range of regex available to the Clip Editor?
Specifically, I am wondering if I can easily parse the selected text using regex pattern and replace it with some other text using the Clips functionality.
mavaddat is offline   Reply With Quote
Old 02-07-2019, 01:43 PM   #2
Doitsu
Wizard
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 4,717
Karma: 15356663
Join Date: Dec 2010
Device: Kindle PW2
Sigil uses a PCRE engine. You should be able to use most standard PCRE operators.
Doitsu is offline   Reply With Quote
Old 02-07-2019, 01:53 PM   #3
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 1,370
Karma: 6862783
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by mavaddat View Post
I see that the Sigil Clip Editor has some basic regex [...] but I don't see any specification of the syntax for the Clip Editor. Does anyone know what the full range of regex available to the Clip Editor?
Sigil uses PCRE engine for regular expressions.

Quote:
Originally Posted by mavaddat View Post
Specifically, I am wondering if I can easily parse the selected text using regex pattern and replace it with some other text using the Clips functionality.
Yes, you can use parentheses () to capture.

Search: ([abc]+)([def]+)([hij]+)
Replace: \1\2\3

Each Regex within the parentheses becomes its own "group", which you can then replace using \1, \2, \3, [...].

acabacdhh

\U tells regex to "uppercase everything beyond this point". So let's say you only wanted to uppercase the groups 2 and 3:

Search: ([abc]+)([def]+)([hij]+)
Replace: \1\U\2\3

acabacDHH

Side Note: See "Use Parentheses for Grouping and Capturing" on Regular-Expressions.info and "Numbered Backreferences" for more information.
Tex2002ans is offline   Reply With Quote
Old 02-07-2019, 04:01 PM   #4
mavaddat
Junior Member
mavaddat began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Mar 2018
Location: Vancouver, BC
Device: Kindle Voyage
Thank you both for your assistance.
I am specifically interested in constructing a Sigil Clip that is able to manipulate selected text according to a pre-defined pattern.
However, I am not sure where I am supposed to put the pattern that I am anticipating when using Clip function.
I know how to do this regex using find/replace, but not with Clip. Where do I specify the find pattern?

Last edited by mavaddat; 02-07-2019 at 04:48 PM.
mavaddat is offline   Reply With Quote
Old 02-07-2019, 05:48 PM   #5
Doitsu
Wizard
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 4,717
Karma: 15356663
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by mavaddat View Post
Where do I specify the find pattern?
You can't use find patterns with clips.

You might be mixing up Clips with Saved Searches (Tools > Saved Searches).
Doitsu is offline   Reply With Quote
Old 02-07-2019, 06:27 PM   #6
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 1,370
Karma: 6862783
Join Date: Jul 2012
Device: Kobo Forma, Nook
The way that Sigil Clips works is you highlight text, and then you apply the Clip.

Your highlighted text will be grouped into:

\1

So let's say you highlight:

Code:
This is text I |want in italics|.
Clip: <i>\1</i>

Code:
This is text I <i>want in italics</i>.
Clips are designed more as a one-button-push for redundant stuff (like pasting in template code for a figure with caption, etc. etc.)

Like I created this Sigil Clip for myself:

Code:
<div class="chart">
      <div class="single-chart">
        <div class="chart-title"></div>

        <div class="image"></div>

        <div class="chart-caption"></div>
      </div>
</div>
and then I can easily just insert the needed info/images.

To do more advanced Search/Replace using Regex, you use Tools > Saved Searches.

Last edited by Tex2002ans; 02-07-2019 at 06:31 PM.
Tex2002ans is offline   Reply With Quote
Old 02-07-2019, 07:35 PM   #7
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: 24,043
Karma: 27923385
Join Date: Aug 2009
Location: The Central Coast of California
Device: K4NT, Galaxy Tab A, Kobo Aura2
But you can replace selected (highlighted) text with a clip.
Here is what I use to uppercase a selection
\U\1\E
theducks is offline   Reply With Quote
Old 02-07-2019, 08:17 PM   #8
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 1,370
Karma: 6862783
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by theducks View Post
But you can replace selected (highlighted) text with a clip.
There also is an "Uppercase" button in the toolbar.
Tex2002ans is offline   Reply With Quote
Old 02-08-2019, 09:48 PM   #9
mavaddat
Junior Member
mavaddat began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Mar 2018
Location: Vancouver, BC
Device: Kindle Voyage
Thanks all! Tex2002ans and Doitsu's responses answer the question for me.
mavaddat is offline   Reply With Quote
Reply

Tags
clips, clips editor, regex, sigil

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Editor: conversion to lowercase with regex Sam Sahara Editor 1 05-13-2018 07:51 AM
RegEx: anchor problem in editor DrChiper Editor 4 04-09-2018 10:15 AM
Error with Clip Editor cleocalliope Sigil 15 08-14-2015 02:47 AM
regex in calibre editor mrmikel Editor 2 02-01-2014 11:39 AM
Guide to Regex in Calibre Editor vs Notepad++ Agama Editor 6 12-23-2013 06:10 AM


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


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