Currently, the only way to determine whether extension should appear in bar or not based on selected text is regex. However, some things are easily parsed with code, but hard with regex.
Start from simple example: I want extension to show up when user selected number between 0 and 255. In code, it’s simple: parse number, compare with bounds. In regex, it’s either imprecise: “\d{1,3}” or complex: “25[0-5]|2[0-4]\d|\d{1,2}”.