Question: Suppose there is a sequence ...a...b...a...b...c... ,where a,b and c are string constants. And dots represent arbitrary number of some other (not a, b or c) symbols between a,b and c.

I would like to match "a...b...c" a laziest way (the last a-b-c triad), but the regexp engine grabs the bigger "a...b...a...b...c" and goes further.

I tried to use a negative lookahead in forms of `a\w+b\w+(?!a)\w+c` or `a\w+b\w+?(?!a)\w+?c` etc. but didn't succeed so far.

Answer: 
You need to use [*tempered greedy tokens*](http://www.rexegg.com/regex-quantifiers.html#tempered_greed) here in between the three parts.

Imagine `a` is `abc`, `b` is `bff` and `c` is `cca`. Then, you'd use

```
(?s)abc(?:(?!abc).)*?bff(?:(?!abc).)*?cca

```

See the [regex demo](https://regex101.com/r/gmBf7Y/2)

**Details**:

* `(?s)` - same as `re.S` or `re.DOTALL` modifier, makes `.` match newlines
* `abc` - a literal string `abc` or some pattern #1
* `(?:(?!abc).)*?` - any 0+ chars other than newline that does not start an `abc` sequence, as few as possible
* `bff` - a literal string `bff` or some pattern #2
* `(?:(?!abc).)*?` - see above
* `cca` - a literal string `cca` or some pattern #3
There's no need to use looakarounds for this. Put `.*` at the beginning of the regexp, and put what you want to match into a capture group:

```
.*(a.*b.*c)

```

Then use `.group(1)` to get the contents of the capture group.

The greedy `.*` at the beginning makes this find the last triad.

[DEMO](https://regex101.com/r/c2sWiS/1)