<commit_before>import sublime, sublime_plugin, re

selector_regex = re.compile(r"@[prae]\[[\w_=,]*\]")

class MinecraftSortSelectorCommand(sublime_plugin.TextCommand):
	def run(self, edit):
		for region in self.view.sel():

			# If no selection, use the entire file as the selection
			if region.empty():
				selection = sublime.Region(0, self.view.size())
			else:
				selection = region

			text = self.view.substr(selection)
			matches = selector_regex.findall(text)
			for selector in matches:
				selector_base = selector[1]
				selector_tags = selector[3:-1].split(",")
				selector_tags.sort()
				newselector = "@{0}[{1}]".format(selector_base, ",".join(selector_tags))
				text = text.replace(selector, newselector)
			self.view.replace(edit, selection, text)<commit_msg>add ! to the command selector regex<commit_after>import sublime, sublime_plugin, re

selector_regex = re.compile(r"@[prae]\[[\w!_=,]*\]")

class MinecraftSortSelectorCommand(sublime_plugin.TextCommand):
	def run(self, edit):
		for region in self.view.sel():

			# If no selection, use the entire file as the selection
			if region.empty():
				selection = sublime.Region(0, self.view.size())
			else:
				selection = region

			text = self.view.substr(selection)
			matches = selector_regex.findall(text)
			for selector in matches:
				selector_base = selector[1]
				selector_tags = selector[3:-1].split(",")
				selector_tags.sort()
				newselector = "@{0}[{1}]".format(selector_base, ",".join(selector_tags))
				text = text.replace(selector, newselector)
			self.view.replace(edit, selection, text)
{'fraction_non_alphanumeric': 0.14276689829437778, 'fraction_numerical': 0.007580543272267846, 'mean_word_length': 4.443298969072165, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '600728', 'n_tokens_mistral': 587, 'n_tokens_neox': 503, 'n_words': 114}