Regular Expressions in the Clipboard

In my current customer project, I write protocols almost daily, which are stored in SharePoint. In the e-mail to the participants I then link to the stored protocol. But the URL does not look very nice:

https://customer42.sharepoint.com/:w:/r/sites/ABC/Technology%20Projects/Shared%20Documents/General/03%20Realization/03%20Planning/02%20Technology%20and%20Infrastructure/Workstream%20Infrastructure%20Services/IT%20Virtualization/Meetings/200430_Virtualization.docx?d=w454d19-24ac2fab6e4f1b-0a29bc5Asa26063f&csf=1&web=1&e=QIUhot

Displayed text contains only the file name in the Microsoft Outlook dialog for edit link When I edit the link it is a bit tiring to cut out the file name in the small Edit Hyperlink window. Can't that just be automated with a regular expression?

The chrome extension “Skim the clipboard” can manipulate the clipboard with regular expressions. With pressing just one key combination Chrome can extract the file name from the long link:

200430_Virtualization.docx

Installation

  • install the Chrome extension Skim the clipboard
  • Open Chrome extension options and press “Add a row (text field)”
Field Input
Name SharePoint file name
Regular Expression .*/([^?]*).*
Modifier
Upercase
Substitute $1
Keep in clipboard
Shortcut one

The long URL is replaced in the clipboard by the file name as the first partial result ($1). For this, everything before the last slash (.*/) ignored first. In the round brackets the file name is then the result. Here we take everything up to the question mark ([^?]*). The remaining part (.*) is then ignored again. The replacement should be done when the extensions key combination “one” is pressed in Chrome.

  • Open chrome://extensions/, click on the menu in the upper left corner, select “Keyboard shortcuts” and choose a key combination for “run shortkey one”, e.g. ⇧⌘Y for Mac OS X