Copy link to clipboard
Copied
Hi guys,
I used a grep style in order to capitalize the first letter of every word on a paragraph (for titles) and I wonder how to correctly catch the single quote/ apostrophe in the sentence, in order not to capitalize some words.
\b(?!(d.|de|des|du|et|au|aux)\b)[\u\l]
I used the following grep, which actually works fine but I had to cheat in order to make it work.
\b(?!(d.|de|des|du|et|au|aux)\b)[\u\l]
exemple of sentence to capitalize : " Messieurs, mesdames d'Arizona, bonjour "
As you could see, I used " d. " for not Capitalizing the " d' " and not making " D' ".
Since the folowwing grep doesn't work, what should I write to excatly catch the single quote/ apostrophe, rather than cheating using the dot.
\b(?!(d'|de|des|du|et|au|aux)\b)[\u\l] -- not working. the ' isn't recognized, neither \'
Thanks for your insights
Looks like ID is recognizing the apostrophe as a word boundary. Seems like putting it in a class does work, however.
Try
\b(?!(d[']|de|des|du|et|au|aux)\b)[\u\l]
Also, you may not need the de, des, or du if you use d[eu'] and au may cover aux as well, but I haven't tested that.
Copy link to clipboard
Copied
Sorry for the double writting of the grep. A shame we can't edit our posts…
Copy link to clipboard
Copied
~' is the GREP sequence to find the apostrophe
Copy link to clipboard
Copied
Well, I tried that one too, but it doesn't work either 😕
Copy link to clipboard
Copied
Looks like ID is recognizing the apostrophe as a word boundary. Seems like putting it in a class does work, however.
Try
\b(?!(d[']|de|des|du|et|au|aux)\b)[\u\l]
Also, you may not need the de, des, or du if you use d[eu'] and au may cover aux as well, but I haven't tested that.
Copy link to clipboard
Copied
Thanks for having found the easiest way to do it and thank you for tips as well. I'm still not quite acustomed with the short ways to write Grep and scripts. I'll be there, eventually ^^
Copy link to clipboard
Copied
This works:
\<\l(?!')
but I have a question: why do you want to capitalize the first letter of each word of a title? It's against the French typographic rules and it seems that you work in French…
Copy link to clipboard
Copied
Thanks for the answer. Seems again there are many ways to get to a viable solution ^^
As per for my need Vs the French typographic rules, I know and understand the point, but let's just say the demand is for the game industry and typographic rules there are commonmy violated for the sake of a supposedly "visual improvement".
Besides, I have no real control on the decison 😕
Copy link to clipboard
Copied
Been thinking about this a bit more, and while it might be working for you at the moment, I thinjk in the general case it may be a failure as it misght not capitalize some words you might intend to be capitalized if they happen to start with de, au or et.
Copy link to clipboard
Copied
I guess just adding a text space after au/de/... will do the thing