Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Finds quoted sentence in python
def find_quotes(self):
quotes_regex = r'(\".*?\"|((?<!\\)\'.*?(?<!\\)\'))'
iterator = re.finditer(quotes_regex, self.current_line())
for match in iterator:
quote_span = match.span()
region = sublime.Region(quote_span[0] + self.current_line_start(), quote_span[1] + self.current_line_start())
if region.contains(self.cursor_position):
return (quote_span[0], quote_span[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment