Extract Label

A clip's label is used to identify the clip in the list of clips in the ClipHistory and in the tree of clips in an AceText Collection. If a clip does not have a label then the start of the clip’s text is used instead. But this can make the collection look disorganized, particularly if you have many clips starting with similar text. It also causes the de facto label to change whenever you edit the clip’s contents.

The Extract Label button on the collection toolbar lets you use a specific part of the clip’s text as the clip’s label. A dialog box appears when you click the button.

You can choose the use the text from the start of the clip stopping at a certain delimiter. The delimiter can be a single character or a string of characters. It can even be a regular expression match. If you loaded some comma-delimited values into a clip, for example, you could first split the clip along line breaks, giving you one clip for each CSV row. Then you could use the Extract Label command with the comma as the delimiter to use the first field of each row as the label.

If you want to use text from the middle of the clip as its label, select the option "text matched by a regular expression". Then the first match of this regular expression in the clip’s text is used as the label. If you want to use only part of the regex match as the label, add a capturing group named “label” to the regular expression. Then only the text matched by this named capturing group is used as the label. With the regex <a[^<>]*+>(?'label'.*?)</a>, for example, you could use the text of the first link in an HTML snippet as the label.

The Exract Label command actually stores the new label in the clip’s Label field. If you edit the clip’s contents afterwards, the label is not automatically updated. You can use the Extract Label command again to extract a new label.

If you don’t need the clip’s contents to retain the label, select one of the first two options in the group “alter the clip’s text”. The last option leaves the clip unchanged. When using a regex match with a capturing group named “label”, the option to remove the label and the delimiter removes the whole regex match, while the option to remove the label but not the delimiter removes only the text matched by the group named “label”.