![]() |
#1 |
Member
![]() Posts: 10
Karma: 10
Join Date: Oct 2008
Device: sony
|
Help with Search Please
Long time since I posted here
Has anyone got some Regex/search that will find punctuation that hasn't got a space after EG ‘Oh, I don’t know,’Jessie groaned Missing space after ’ or before Jessie What I want to find is ,’ Not followed by a space Quite a few of them and not just speechmarks but question marls, exclamation marks. Really hard to spot I'm using Sigil Thank you |
![]() |
![]() |
![]() |
#2 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 20,823
Karma: 27620684
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
![]() BR |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 27,798
Karma: 198099188
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
\p{P}[^ ]
Or \p{P}(?!\p{Zs}) The latter should work for any kind of space character. |
![]() |
![]() |
![]() |
#4 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,151
Karma: 18843349
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
You can use a negative look ahead
Here is a PCRE regex cheatsheat that may help. So a find of a punctuation symbol [:punct:] followed by the negative lookahead (?! ) should find punctuation not followed by a space. Unfortunately, it would also find any punctuation with no following space at the beginning of the word…. So you might want to add a negative look behind to make sure there is no preceding space as well (?<! ) Find: (?<! )([:punct:]+?)(?! ) Replace: ‘\1 ‘ (a space after the 1 with no quotes) Warning: I reserve the right to be wrong. I haven’t tested this and am writing from my phone in a post-surgery drug-induced euphoria…:eek: TEST THOUROUGHLY and save often. Sigil has some awesome new features that can help with making save points and seeing what changes will be made before you commit. Also, I’m quite sure there are other ways of doing this; maybe even more elegant. Last edited by theducks; 07-14-2024 at 02:00 PM. Reason: turned off smilies |
![]() |
![]() |
![]() |
#5 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,151
Karma: 18843349
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Dang it! Ninja’d TWICE!
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,151
Karma: 18843349
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
And that should read (:punct:)
Last edited by Turtle91; 07-14-2024 at 07:14 AM. |
![]() |
![]() |
![]() |
#7 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,151
Karma: 18843349
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Another warning…. Did I mention I’m loopy??…. This will also match words with contractions (eg I’m they’re we’ve) so you may want to dumb it down and just look for the specific occurrences one type at a time.
Code:
Find: ,’(?! ) Replace: ,’ (With a following space) |
![]() |
![]() |
![]() |
#8 | |
Member
![]() Posts: 10
Karma: 10
Join Date: Oct 2008
Device: sony
|
Quote:
Get well soon Turtle91 Last edited by dearleuk; 07-14-2024 at 09:01 AM. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
New Feature? Embed search term as a tag into Search Results with one click? | mikhail_fil | Library Management | 1 | 04-02-2022 10:18 PM |
Removing Search from Search Bar Not Bringing You back To author menu | chantw0968 | Calibre | 7 | 11-09-2017 07:51 AM |
Regex in search problems (NOT Search&Replace; the search bar) | lairdb | Calibre | 3 | 03-15-2017 07:10 PM |
Regex Search doesn't search all files in Edit Book | GregTheGrate | Editor | 8 | 11-08-2016 12:47 AM |
Google Book Search to search full-text books online | Bob Russell | Deals and Resources (No Self-Promotion or Affiliate Links) | 1 | 08-19-2006 12:13 PM |