07-14-2024, 07:04 AM | #1 |
Member
Posts: 12
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 |
07-14-2024, 07:24 AM | #2 |
null operator (he/him)
Posts: 20,997
Karma: 27620706
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
thanks
BR |
Advert | |
|
07-14-2024, 07:55 AM | #3 |
Grand Sorcerer
Posts: 28,040
Karma: 199464182
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. |
07-14-2024, 07:59 AM | #4 |
A Hairy Wizard
Posts: 3,223
Karma: 19000635
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 03:00 PM. Reason: turned off smilies |
07-14-2024, 08:00 AM | #5 |
A Hairy Wizard
Posts: 3,223
Karma: 19000635
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 | |
|
07-14-2024, 08:09 AM | #6 |
A Hairy Wizard
Posts: 3,223
Karma: 19000635
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 08:14 AM. |
07-14-2024, 08:30 AM | #7 |
A Hairy Wizard
Posts: 3,223
Karma: 19000635
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) |
07-14-2024, 08:48 AM | #8 | |
Member
Posts: 12
Karma: 10
Join Date: Oct 2008
Device: sony
|
Quote:
Get well soon Turtle91 Last edited by dearleuk; 07-14-2024 at 10:01 AM. |
|
|
Similar Threads | ||||
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 11:18 PM |
Removing Search from Search Bar Not Bringing You back To author menu | chantw0968 | Calibre | 7 | 11-09-2017 08:51 AM |
Regex in search problems (NOT Search&Replace; the search bar) | lairdb | Calibre | 3 | 03-15-2017 08:10 PM |
Regex Search doesn't search all files in Edit Book | GregTheGrate | Editor | 8 | 11-08-2016 01: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 01:13 PM |