bell notificationshomepageloginNewPostedit profile

Topic : Autocapitalize/correct two connected words? Let's say I have a character in my story simply called "Slime Monster". With every instance of these two words, I want both words to be capitalized - selfpublishingguru.com

10.01% popularity

Let's say I have a character in my story simply called "Slime Monster". With every instance of these two words, I want both words to be capitalized and to be corrected as a pair, so if I mistype it to something like "Silme Mosnter" it will recognize the correct spelling as "Slime Monster".

Is there a way to set up the dictionary like that? I'm using the Windows version (Version 1.9.9.0).


Load Full (1)

Login to follow topic

More posts by @Courtney562

1 Comments

Sorted by latest first Latest Oldest Best

10% popularity

Two possible approaches.

Before you start typing your text. You can set up a list of auto-complete words. From Project -> Project Settings -> autocomplete.
After you typed. You can use the find command in Edit -> Find. Set the Find Options to Regular Expressions (regex). Place the desired Regular expression in the top box, and Slime Monster in the lower box. Make sure you tick the ignore case box and you are good to go. If you are worried that the regex will have false positives, you can click on Next and only replace those occurrences that look wrong.

A bit on Regex.

This requires some knowledge of what regex can do. The one fitting your request could be a search for the two words containing the letters of Slime and Monster.

b[slime]+b b[monster]+b

Note that this will also match any pair of words whose letters are included in slime and in monster, e.g. "me so" and "see soon"

A bit more complex regex, which is also more accurate, could be:

b(?=b(?:[^slime]*[slime]){4,6}[^slime]*b)[slime]{4,6}b b(?=b(?:[^monster]*[monster]){5,8}[^monster]*b)[monster]{5,8}b

[slime]{4,6} tries to match any word made from the letters in slime, with length between 4 and 6. The whole thing tries to match a pair of words, the first of which is between 4 and 6 letters and is composed only of letters from "slime", and the second is between 5 and 8 letters and is composed only of the letters found in "monster". Note that there is a space in between the two, which is also used in the matching.

As written above, do not forget to check the ignore case if you want to correct the capitalization as well.

This answer was inspired by the excellent SO answer: stackoverflow.com/questions/4389644/regex-to-match-string-containing-two-names-in-any-order


Load Full (0)

Back to top