Generic or Universal Text Expansion

###The situation
There are certain expansions that to my mind are generic. Ever since I was taking notes at school I have used a shorthand whereby I substitute the suffix -ation with just n, so:

organizn > organization
compiln > compilation

…and so on.

###The idea
It seemed to me that this would be one situation where KBM may have more to offer than TextExpander (I happily run both on my system) simply because I could create a generic macro that uses Regex.

What I have for the moment is this trigger: [^aeiou]n[\h.,;:-]

The idea is that any word that finishes with a consonant ([^aeiou] in regex) and n is caught by this trigger, which then:

  • executes two deletions; and
  • inserts the text: ation.

Just for completeness, and the uninitiated, the [\h.,;:-] represents ‘a non-word character’ and is there to catch the word ending, whether it be a comma, space, full stop (period) or whatever. (Note that I did try using \W and this fell down with the word doesn’t.)

The real regex is actually this [^aeiouw]n[\h.,;:-] because of words like down, own and grown

###What I’d like to improve
So far so good. Except that as things stand, I am losing my non-word character (my macro obviously deletes it along with the n) because I can’t quite see how I might catch it and re-use it.

I did try to use a left-arrow keystroke, except that seems to be a problem because I think KBM is ever-so-slightly behind me as I continue typing away.

What I think I need to do is to capture the character represented by the [\h.,;:-] and have it pasted after the ‘ation’ element.

Is that possible?

###Other issues
Although it serves my purposes very well, there are (inevitably) exceptions for words such as appropriation where my system doesn’t work because the -ation element is preceded by a vowel.

There are other suffixes which could have the same treatment - for example using a g which would expand to the suffix -ing.

1 Like

The %TriggerValue% token has the match, so you can extract the non-word character and put it back.

And yes, if you do this while typing fast it is likely that the sequence of characters will get lost. Catching the non-word character mitigates the issue somewhat because people tend to pause more after the non-word character than before (especially for spacebar which tends to be hit almost simultaneously with the last character).

You could add a secondary trigger for “approprin” or some subset of that. Macros can have more than one trigger.

1 Like