GSAK (Geocaching Swiss Army Knife)
Contents - Index

Rename Attachments (File=>Get e-mail)


To use this feature you must:

1. Use RegEx for matching your subject line
2. Have one sub expression in your RegEx - it will then become the name of your file
3. Tick the box "Use subject to name saved files"

Using this method allows you to match the subject line any way you like, but then just pick out the section of the subject line you want to give to your file name.

Example. The subject of the email is :

[GEO] Pocket Query: My Found Caches

What you want is to match any subject line that has "[GEO] Pocket Query:" in the subject line, and then you want to name the attachment what ever is after this matching string.

The required RegEx would be:

\[GEO\] Pocket Query: (.*)

Caution: Make sure you include the "space" after "Query:"

Now let us analyze this regular expression in detail.

Because the "[" character has special meaning in a regular expression, we need to escape it with the "\" so the regular expression sees this as a literal rather than this special character. So everything up to (.*) tells us to only return a match if this string is found. 

The opening "(" bracket is the start of our sub expression. The ".*" tells the regular expression to now match all characters from now to the end of the subject line. The closing ")" bracket is the end of our sub expression. 

For a better understanding please see this link

The resulting sub expression will then be "My Found Caches". So if the original attachment was "12345.zip" it would now be renamed "My Found Caches.zip"

Using this Regular expression would then be generic for all emails sent from Geocaching.com where you wanted the name of your attachment changed to what ever is after "[GEO] Pocket Query:"

Note: you can use any regular expression you like inside the sub expression (but of course it must match) to give you your file name. For example, let us say you want to limit the name of the saved file to the first 10 characters, you would then use the following RegEx:

\[GEO\] Pocket Query: (.{10})
Copyright 2004-2019 CWE Computer Services  
Privacy Policy Contact