Created
October 22, 2017 20:53
-
-
Save Bajena/92ee531659e66dd3dea5e0fedabf7025 to your computer and use it in GitHub Desktop.
Finds quoted sentence in python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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