December 2, 2015

TextExpander URL Subdomain Slicer

Today's snippet example is highlighting the power of built in JavaScript utilities with TextExpander. Both are pretty powerful tools and lots of flexibility. Together they make you super productive.


JavaScript has a lot of very cool built in text utilities. You can easily implement some of these in TextExpander. This week we are going to look at a cool use of the JavaScript slice tool.

In my testing enviroment we have different subdomains and sometimes I just need to reference the one I am working on. So I created this simple TextExpander JavaScript snippet:

JavaScript Snippet

var mylocation = '%clipboard';
var start = mylocation.indexOf("://")+3;
var end = mylocation.indexOf(".")
var domain = mylocation.slice(start,end);

Snippet Abbreviation


Real World Use

When I comment in a ticket, I can now easily reference the server that I am working on as part of the description text:

I am encountering a problem on the dev20 server when trying to login:


Add your Comments

Feel free to leave a comment about this post.

- Feel Free to add HTML to your comment!