Match column in tags

20 views
Skip to first unread message

Martin Larsen

unread,
Nov 29, 2023, 2:55:32 AM11/29/23
to CopyQ
Hi,

After reading the doc several times and experimenting for 20 minutes, I still haven't got any clue of what the match column in tags are used for.

I would appreciate a short explanation :)

Thanks,
Martin

Lukáš Holeček

unread,
Dec 15, 2023, 7:11:52 AM12/15/23
to Martin Larsen, CopyQ
The documentation for tags and the actual configuration is not great.

The Match is a regular expression for matching tag text. The style/color/icon/name are applied to a tag only if its text matches the expression on the same row in the configuration.

If you leave the Match empty, the Name is used to match the tag instead.

The configuration can be quiet powerful but is very difficult to understand.

Example:

    Name=\1 Match=(.*) Color=blue

This would change all tags to blue color. The parentheses in the regular expression capture the text (".*" matches any text). The captured group then can be used in Name with "\1" placeholder.

I hope this clear things up a bit.

Lukas


--
You received this message because you are subscribed to the Google Groups "CopyQ" group.
To unsubscribe from this group and stop receiving emails from it, send an email to copyq+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/copyq/c9930750-720d-4f82-bdf8-d7c8b5b15792n%40googlegroups.com.

Martin Larsen

unread,
Dec 20, 2023, 8:44:24 AM12/20/23
to CopyQ
I am at least beginning to understand :-)

First of all, I thought that the regex would match against the selected item, not the tag name itself.

I still have a couple of questions, though.

1. Why does the regex tags show up in the list of tags I can apply?

If I make a tag from your example, Name=\1 Match=(.*), it shows up in the list of tags:

tags.png

Does that make sense? I mean, the purpose of these kind of tags are to control or change other tags, right?

2. If I make a tag with Name=Test Match=(.*), then all the other tags will now become TestTest, not just Test. Why is the name doubled?
Reply all
Reply to author
Forward
0 new messages