Skip to content

Instantly share code, notes, and snippets.

@sonofevil
Last active March 11, 2021 13:44
Show Gist options
  • Save sonofevil/07abb5635e3a8738800f28749685f17a to your computer and use it in GitHub Desktop.
Save sonofevil/07abb5635e3a8738800f28749685f17a to your computer and use it in GitHub Desktop.
GIMP RegEx tag parser
RegEx pattern for Kate to parse tags from identifiers in ~/.config/GIMP/2.10/tags.xml
Only parses up to the first 6 words (no-whitespace-strings) of an identifier.
Requires that at least one tag already exists for that identifier.
Regex handling may or may not be specific to Kate.
search:
(<resource identifier=")([^\w"-]*([\w-]*)[^\w"-]*([\w-]*)[^\w"-]*([\w-]*)[^\w"-]*([\w-]*)[^\w"-]*([\w-]*)[^\w"-]*([\w-]*)[^\w"-]*)(" checksum="\(null\)">\n\s*<tag>[^<]*</tag>)
replace:
\1\2\9\n <tag>\L\3\E</tag>\n <tag>\L\4\E</tag>\n <tag>\L\5\E</tag>\n <tag>\L\6\E</tag>\n <tag>\L\7\E</tag>\n <tag>\L\8\E</tag>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment