![]() |
#1 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
Is there a way to use the selection in a Saved Search?
Editing a book with a number of foreign words repeated in many places that I wanted to bracket in <i>foreign_word</i>
I was using Find: (foreign_word#1), Replace: <i>\1</i> Get the next word or phrase, repeat Occurred to me that if I had a Saved Search that would use the Selected text: Find: ($Selected), Replace: <i>\1</i> then I could just select the text, run the search, select next text, run search, repeat Last edited by phossler; 02-12-2019 at 12:48 PM. |
![]() |
![]() |
![]() |
#2 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,934
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:
Last edited by BetterRed; 02-12-2019 at 03:34 PM. Reason: Couldn't read Lime |
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 447
Karma: 3886916
Join Date: May 2013
Location: Ontario, Canada
Device: Kindle KB, Oasis, Pop_Os!, Jutoh, Kobo Forma
|
|
![]() |
![]() |
![]() |
#4 |
Interested in the matter
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 421
Karma: 426094
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook InkPad 3
|
|
![]() |
![]() |
![]() |
#5 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
Quote:
As example, the same store search using _SELECTION_ in Find What could be used in both cases just be selecting the word and running the same Store Search |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
I tried that, but it doesn't seem to just bracket the marked word
|
![]() |
![]() |
![]() |
#7 |
Interested in the matter
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 421
Karma: 426094
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook InkPad 3
|
Did you press the Find button and then the Replace button?
|
![]() |
![]() |
![]() |
#8 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
Yes
Double Clicked the word (Oktober) to select just the word, Ctrl-Shift-M to Mark it, and clicked Saved Search (Test) to [Find] Them Saved Search [Replace] Looks like the rest of the paragraph gets the <i> … </i> and not just the one word I was looking for Interestingly, it seems like the Marked area was extended to the rest of the paragraph also |
![]() |
![]() |
![]() |
#9 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,934
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:
I think you want something less 'grabby' like (\w+) |
|
![]() |
![]() |
![]() |
#10 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
It's a little awkward since it only seems to work with the word after the empty text cursor (insertion point)
I have to put the cursor before the word, Find and Replace. That's OK -- just counter-intuitive It doesn't work for a selected phrase; it just Finds the single word after the selected phrase, and applies the Replace to just that word I'm guessing that even RegEx has no way to 'read' what ever the selected text is, so that was where my thought process conops of using a 'marker'(e.g. _SELECTION_) which would use whatever the selected text is |
![]() |
![]() |
![]() |
#11 |
Interested in the matter
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 421
Karma: 426094
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook InkPad 3
|
|
![]() |
![]() |
![]() |
#12 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
I understand that part (now), but that still only Replaces that single instance of marked text
The other occurrences in the document are not replaced So in my "Oktober" test case, the marked instance does get replaced by <i>Oktober</i>, but the other 199 occurences of "Oktober" do not |
![]() |
![]() |
![]() |
#13 |
Interested in the matter
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 421
Karma: 426094
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook InkPad 3
|
Oh! okay. Then I think we should use the universal copy and paste (in parentheses, see image). Without marking anything. Last edited by jbacelar; 02-13-2019 at 01:10 PM. |
![]() |
![]() |
![]() |
#14 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
That sounds interesting -- I could make that work.
Is that a different screen from the one attached? I couldn't find one that looked close Few extra steps (copy the word(s) & paste CAREFULLY between the (..) ) It's be a little smoother if _SELECTED_ or something was canned in the stored search, but your idea is pretty good I have to add some more Replaces to handle words in different languages, something like Find: (……) Replace: <span lang="de">\1</span> Thanks Last edited by phossler; 02-13-2019 at 03:55 PM. |
![]() |
![]() |
![]() |
#15 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,934
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Maybe you could have your search use the 'OR' type regex
(aword|bword|cword|dword) |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Difference in Manual Search and Saved Search | phossler | Editor | 4 | 10-04-2015 12:17 PM |
A wee request regarding search notification (and file selection) | sherman | Editor | 1 | 04-06-2014 10:50 AM |
Sending selection from Search & Replace to different fields? | MelBr | Calibre | 2 | 03-05-2013 01:00 PM |
Saved Search: How 2 | theducks | Library Management | 3 | 11-27-2012 02:10 PM |
Need help setting up a saved search | ficbot | Calibre | 1 | 07-10-2010 02:10 PM |