I’m not sure if there is a way to do it on one layer/expression, I tried with a similar project (blinking cursor and everything, actually!) and I just ended up creating a second text layer with the source text sampling the original text. I’m not sure how you decided to create your blinking cursor and how the expressions are set up for you, but for me it looks something like this:
1. I grab the original text’s sourceText that I’ve animated with a range selector to have it reveal as it’s “typed.”
originalText = thisComp.layer("original text").text.sourceText;
2. Then I create a variable for the font style. (It’s been a bit since I learned how to do this, so I don’t remember the technical reason for why you need to write this.)
newText = originalText.style;
3. after that, I set an expression for the blinking cursor itself.
I replace all the text with every character I would have used in the original text, using the javascript “replace” method and Regular Expressions to include all the characters I wanted. I didn’t have a procedural method for generating these characters, so instead I just ran my finger across my qwerty keyboard in order. Then I replaced all the characters with the character I chose to use for the blinking cursor, which is “W”.
(For context on why this looks weird, I’m using a pixel style font where each character is inside an 8×8 pixel block, and then to create a 1 pixel outline around each character I created a second pixel font that is the Bold version. It just so happens that the “W” character is a solid 8×8 block, so I used that character for my blinking cursor icon.)
newText = originalText.replace(/[qwertyuiopasdfghjklzxcvbnm,.?!' ]/gi,"w");
then I updated this layer with a new Range Selector animation that trimmed down the text to show a single character, and then animated the “Offset” value with an expression tied to the original layers “Start” value so they would line up. Hopefully that is helpful, I’m unsure if our approaches are similar enough to solve anything on your end.