Skip to content

Instantly share code, notes, and snippets.

Created October 22, 2017 20:53
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Bajena/92ee531659e66dd3dea5e0fedabf7025 to your computer and use it in GitHub Desktop.
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