nice to see you.
You are totally right – there are so much possibilities.
(And I also thought about [[:punct:]] but the TO say: „… lacks a full stop (a dot) …“)
Cool to read you too!
Finally, when it's a question of punctuation, I think a pragmatic way could be better:
… Add other glyphs you would want between the 2 brackets!
This code is better because, e.g. it adds a dot after a )
Don't forget footnotes and tables too!!
back to the sandbox
do you mean
and/or the equivalent for (only returns)
Yes pixxxel, written too fast!! Thanks my friend! ;-)
Thank you so much for your answers!
The problem is that all of the GREP phrases above finds every \r even if there is a full stop right before it. I only want to find \r that have no full stop in front of them...
samuelrh Obi-wan grep work well
Hi, and thanks again!
I understand your grep as: "Find every character except punctuation characters at the end of a paragraph", but what I want is "Find every character except full stops followed by a carriage return (\r)", but I dont get it working at all.
What I want to achieve is finding sentences/paragraphs that doesn´t end with a full stop.
This is what your latest grep looks like:
And this is what my original grep ([^.])\r looks like:
1/ Use blank lines is not a good idea! Use before/after spaces.
2/ There's no space at the beginning of my grep code:
3/ If you do as said in 1/,
Yours ([^.])\r works cool if no blank lines, if not the end of table cell, end of story or end of footnote and if each para finish by a \w or a \. if : ? ! , ; : … you'll have a problem!
That's what I mean by:
Where you can simply define the chars not concerned by the regex!
Depending on the language of the text, there are many cases where it would be correct not to end a sentence with a full stop, and I don't think you will find a universal expression that is going to work (for example, you might need to run other queries first to set the order of quotation marks and punctuation). I think Salah's last suggestion comes closest so far, but I would change it to find ([\l\u\d])\s*$ and change to $1.
I've added the \d in case the sentence ends with a date or other number, and added trailing whitespace. You'd need a second query, though to find trailing whitespace after anything other than an uppercase or lowercase letter or digit.
This query seems to work as intended here in CS6, with one anomaly. If you run it stepping through the document using Change/Find or just Change, then press the Find Next button, and it finds the end of the story BEFORE finding another paragraph, it will add a second full stop at the end of the story. This does not happen if you press Change All, and it may be a bug.
OK, I was wrong about it not happening using Change All. I just tried again using a refinement: ([\w])\s* instead of ([\u\l\d)\s* and started with the cursor in low in the story and it changed the end of story paragraph twice.
I suspect your expression would also work as well as mine, IF you add a check for trailing white space. And do you see the same end of story anomaly?
I'm also concerned about false positives for footnotes, but that doesn't actually seem to be a problem unless the numbers are typed manually.
As for Obi-wans´ 1/ this is a word document from a customer, mounted in InDesign, that I need to tidy up. This is why I have problems with sentences that should end with a full stop not doing that. So the use of blank lines is not up to me :-)
[^[.]$ should do what I want (find any charachter except full stops, at the end of a paragraph, but when I try it that search doesn´t find a thing :-/
@Peter I´m aware that there are occations where I would like to not end the sentence with a full stop, but I don´t intend to do a "replace all" search, since it would change those too. From what I understand using your grep finds every defined type of character (any letter or digit) followed by white space at the end of a paragraph, but I wonder if it´s possible to have a NOT statement, like "Find any character EXCEPT a full stop, followed by a carriage return \r" since that is what I want to find; every end of a paragraph not directly preceded by a full stop.
Many of the sentences in the text I´m going through ends with ) or § so I modified your grep to ([\l\u\d\)\§])\s*$ and it seems to work! Thank you so much!
Could you just explain why you added the \s? When I do the search it finds occasions where there is no white space before the end of the paragraph. Why is this?
OK, I do like the [^[:punct:]] construct, but it has problems with the trailing whitespace since [^[:punct:]] includes \s. I think it would be better to include in a positive class the actual symbols you think should end a sentence but be followed by the dot, so ([\w~6\0\}\]])\s* (and possibly add copyright and trademark symbpols, too, if the text is likely to use them).
I'm not able to watch your movies on my laptop for some reason -- Probably need to install a new codec, but \s* means any white space that occurs 0 or more times, so it is optional, i.e. if it is there it will be found (and removed), but the absence of trailing white space won't prevent finding paragraphs that end with a word character or your symbols.
@Peter. Ah, I see! I didn´t think about it mening zero or more times.
Again, thanks so much every one of you that helped me solve this!
You took the problem in the wrong way!
First, clean up the text (remove blank lines and end-para useless spaces …).
Then, treat your problem!
Pixxxel, for me, Game Over! Nothing to add! !
After messing around a bit I found out what was wrong with my original search, it found any character except a full stop at the end of a paragraph. That means it included \r as a character, which meant it found every paragraph ending with an \r, regardless of having a full stop or not at the end.
So if I exclude \r and the full stop, it works for me, and seems to look for what I wanted; a sentence/paragraph ending whith any character except a full stop or a \r
If found \r because you have a blank line after!! [see last line of post#9]
This reminds me the story The Three Little Pigs and Bib Bad Wolf!
I´ve tried posting #22 now and it seems to work just fine! But I don´t understand it... In my eyes this searches for any character except a full stop or a punctuation character followed by zero or more whitespaces at the end of a pharagraph. I don´t get how it finds paragraphs ending with for example ) or !
Since I´m trying to learn I would be grateful if you could spell out what your expressions mean, like "this expression searches for any charachter that bla bla bla..."
And I would also be grateful if you could explain the differences between my solution and the one you present, and which one I should choose and when and why? This is if you have the time and patience to explain!
My grep: ([^.\r])$
Your grep: ([^.][^[:punct:]])\s*$
As for #25 you are right Obi-wan :-)
I hope, my english is good enough.
your grep searches for:
begin to save in $1
every character except a dot
(save one character in $1) or (save one character in $1)
end to save in $1 (summary: found one character)
before end of paragraph (found this character too, but do not save in $1)
my grep searches for:
begin to save in $1
every character except a dot
(save one character in $1) and (save a second character in $1)
every character except a punctuation character
end to save in $1 (summary: found two characters)
followed by zero or more whitespaces (found this characters too - if exists - but do not save in $1)
at the end of a pharagraph (found this character too, but do not save in $1)
I'm going to renew my objection to using [^[:punct:]] as it will match (and leave) the first trailing whitespace character before the end of paragraph.
pixxxel schubser, thank you so much for taking the time explaining this for me!