Hi, I've just installed xfce4-clipman and xfce4-clipman-plugin from debian unstable repository. I've decided to start using action, especially the built-in "bug". I've changed the pattern to "#([0-9]+)". This pattern doesn't match the following snippets : closes: #519165 … and any other variants But it does match the following ones : #519165 #519165. #519165 and some example values This is ambiguous : there is no "^" at the beginning, but if the selected text doesn't start with the pattern, it doesn't raise the popup menu. However, there's no "$" at the end but it matches values that don't end with the defined pattern. We should fine a clean way to handle this, or it will confuse users.
There is a voluntary regex flag G_REGEX_ANCHORED, from the API: The pattern is forced to be "anchored", that is, it is constrained to match only at the first matching point in the string that is being searched. This effect can also be achieved by appropriate constructs in the pattern itself such as the "^" metacharater. You can put '.*' in front or in the end. The reason is that doing matches with anchors at the beginning and the end may trigger unwished menu popups on long or very long text selections. What if I put the extra ^$ around the text entry to make it more clear in that case?
I'm in front of a dilemma :) First, I'm used to use regexps, so I really know how to use ^ and $, and why they should be extensively used. If I have to fill a regexp field, I fill it with those metacharacters (or not) and get the expected results. However, for this particular use, I know that I will always want them. And it will be much simpler for the simple user who's not a regexp guru. So I think that yes, you should write the fact the pattern is automatically wrapped inside ^ and $. Maybe it could be useful to write down that adding ".*" could bypass this thing, but I'm not sure it's really useful. Power users will obviously know this, and simple users just want to match simple snippets.
I pushed a change within the glade file to inform about the anchor flag.