![]() |
#1 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 541
Karma: 1152752
Join Date: Aug 2010
Location: Evansville, IN, USA
Device: Samsung Galaxy Tab 4 Nook & Samsung Galaxy Tab S 10.5
|
Help with regex POSIX class search
Maybe it would be a good idea for a whole subforum related to regex searching!
I'm stuck on yet another regex search. I'm trying to find any punctuation characters that don't have a space following them. Looking at my regex cheatsheet, it looks like I should be able to do this with a POSIX class search. I've tried [:punct:]\S but it doesn't seem to work. Instead, this search shows me every occurrence of the letters p, u, n, c & t that aren't followed by whitespace. Pretty much, it's doing the same as a grouping, like [punct]\S. It's like Sigil isn't paying any attention at all to the fact that there are colons in the search string. Am I missing something or doing something completely wrong here? Any assistance would be most appreciated. Thanks. - Byron Last edited by bfollowell; 05-19-2011 at 05:05 PM. |
![]() |
![]() |
![]() |
#2 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 121
Karma: 5070
Join Date: Dec 2010
Device: none
|
Code:
:punct: |
![]() |
![]() |
Advert | |
|
![]() |
#4 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 541
Karma: 1152752
Join Date: Aug 2010
Location: Evansville, IN, USA
Device: Samsung Galaxy Tab 4 Nook & Samsung Galaxy Tab S 10.5
|
Thanks for the info guys. I'll find a workaround like you mentioned huebi. When you say it isn't available in Sigil, do you mean the punct search or POSIX class searches in general?
Jellby, thanks for the QRegExp reference. I'm sure it will come in handy. I really appreciate your guys' help. - Byron |
![]() |
![]() |
![]() |
#5 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 61
Karma: 12096
Join Date: Sep 2010
Location: Tasmania
Device: Sony PRS 650
|
POSIX is not implemented in Sigil. In this case it wouldn't help you anyway unless you are planning on doing a one-by-one replacement rather than Replace All.
Think what would happen to this: "Hello!" My guess is that it would become " Hello! " Try this for your search: Find: ([^\nA-z0-9 -“/])([^ \n”]) Repl: \1 \2 In the Find string there is a space between the 9 and the dash. See below for quotes. In the Repl string there's a space between the \1 and \2. You will need to tweak it to suit your needs by adding, in the Find string, any punctuation you do not want followed by a space. For example if you're using it in Code View then use this Find string: ([^\nA-z0-9 -“/<>])([^ \n”]) to avoid angular brackets having spaces added after. The problem is quotes. If you can, make the double quotes curly - the first one of the type that occurs at the start of a quote (opening) and the second one of the type that ends a quote (closing). The text being searched must also have curly quotes. Interestingly the search string does not find square brackets or the '&' not followed by a space. Sort of convenient! Last edited by Faster; 05-20-2011 at 02:36 PM. |
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 541
Karma: 1152752
Join Date: Aug 2010
Location: Evansville, IN, USA
Device: Samsung Galaxy Tab 4 Nook & Samsung Galaxy Tab S 10.5
|
Quote:
This wouldn't be a problem for me as I didn't plan to batch correct in this instance; only investigate. Thanks for your advice though. I'll look it over and try it out. - Byron |
|
![]() |
![]() |
![]() |
#7 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,720
Karma: 1759970
Join Date: Sep 2010
Device: none
|
NB sometimes it is correct for there not to be a space after a punctuation mark as in thre "hello!" example above, or as in
"right," said Fred the "rule" may be that punctuation should be followed either by a space or by a quote mark, but initials may be another exception : J.B.Lenoir or J. B. Lenoir ? |
![]() |
![]() |
![]() |
#8 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,543
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Or numbers: 3.1416
Or parentheses: (Like this.) ... |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
PRS-650 SD Card Importance? SDHC, SDHC Class 4, Class 10 etc is it important | Renji | Sony Reader | 11 | 12-03-2011 12:30 PM |
Strange behavior with advanced catalog search (regex) | QuantumBeep | Library Management | 1 | 02-21-2011 11:06 AM |
need regex help search and replace | schuster | Calibre | 4 | 01-10-2011 09:00 AM |
Regex search author field to locate books? | Starson17 | Calibre | 2 | 12-21-2009 10:40 AM |
regex search for roman numerals | Blurr | Calibre | 2 | 12-16-2009 05:55 PM |