Skip to main content
dublove
Legend
July 14, 2024
Question

Between the top 3 and the last 2 positions, I want Insert ~- in front of each character. how to?

  • July 14, 2024
  • 1 reply
  • 174 views

Between the top 3 and the last 2 positions, I want waInsert ~- in front of each character, how to write the regular expression?

Yes, there are more than 5 characters in words.

For example:

 

why Meteorological book

 

After insertion:

This topic has been closed for replies.

1 reply

Robert at ID-Tasker
Legend
July 14, 2024

You have posted few scripts already - don't understand why you should have a problem with this? 

 

You need to get a reference to your word - then use insertionPoints collection - and count from the back / end - or from the start, but from the back would be easier:

 

 

 

myWord.insertionPoints[-3].contents = discretionary_hyphen_code;

 

 

 

You need to remember, that "-1" is the insertion point AFTER the last character "-2" is BEFORE last character and so on. 

 

You might want to do it in the loop.  

 

Collection of insertionPoints always has one more element than collection of characters - in ANY text object.

 

 

Or it might be also done with GREP. 

 

dublove
dubloveAuthor
Legend
July 15, 2024

@Robert at ID-Tasker 

Hello, is there a complete code?
Thank you ~
Can't implement it in regular regularity?