Selection lengths

Is there a way I can find how long a given selection is?
And, is there a way I can filter a set of selections based on length (e.g. >30 chars)?

For example: find all constraint names longer than 10 chars in the following.

ALTER TABLE foo ADD CONSTRAINT foo_pk PRIMARY KEY (foo_id);
ALTER TABLE bar ADD CONSTRAINT bar_baar_pk PRIMARY KEY (bar_id);
ALTER TABLE baz ADD CONSTRAINT baz_thisisareallylongconstraintname_pk PRIMARY KEY (baz_id);

Select your identifiers, then keep selections longer than 10 characters:

<a-k>.{10}<ret>

Another solution with a shell command:

$[ $kak_selection_length -gt 10 ]<ret>
2 Likes