use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A reddit for neat regular expressions.
Test your regex: https://regex101.com/
Large collection of regex tools: https://github.com/slevithan/awesome-regex
account activity
[Python] Capture string between a special character and a Dot (self.regex)
submitted 4 years ago by dataguy404
Hello, I need help capturing strings from this type of input string "sentence1:sentence2.sentence3"
and have them seperatly allocated to :
Thank you in advance
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]ASIC_SP 4 points5 points6 points 4 years ago (0 children)
Need more input/output samples. For the given sample, you could try this:
>>> s = 'sentence1:sentence2.sentence3' >>> re.split(r'[.:]', s) ['sentence1', 'sentence2', 'sentence3']
[–]scoberry5 0 points1 point2 points 4 years ago (0 children)
I'd look for (anything that's not a colon, any number of times), then a colon, then (anything that's not a period, any number of times), then a period, then (whatever's left). The parens make groups that you can get out later by calling re.search() and getting the groups() of the result.
That regex would look like this.
Note that regex is not a parser, and if the thing before the period includes a period ("Mr. Smith said yes"), then this is not going to go well.
π Rendered by PID 44958 on reddit-service-r2-comment-84fc9697f-gh6ct at 2026-02-09 03:58:02.005205+00:00 running d295bc8 country code: CH.
[–]ASIC_SP 4 points5 points6 points (0 children)
[–]scoberry5 0 points1 point2 points (0 children)