# Positive Lookaheads

> Oh, you're looking for something? Well, I'm looking for something too.

March 7, 2023 · 1 min read · https://yasint.dev/positive-lookaheads/
Tags: regex, tools

---

Find expression $$x$$ where expression $$y$$ follows:-

Suppose you need to match all the first names ending with last name _Picasso_.
You could write the following pattern to solve it.

```regexp hideLineNums
([a-zA-Z ]+)(?=Picasso)
```

![Regex Breakdown](./regex-breakdown.png)

```txt hideLang
Paloma Picasso // => true
Maya Picasso // => true
Steve Ross // => false
```

To experiment, navigate to the [Regex101 sandbox](https://regex101.com/r/wfl5Ad/1)
I've created. This RegEx only works with Non-Deterministic Automata (NFA) regex engines.

### Reading list

- [Regular Expressions with Lookahead (Martin et. al, 2021)](https://www.diva-portal.org/smash/get/diva2:1641657/FULLTEXT01.pdf)
- [NFA vs DFA by Daniel Bazaco](https://www.abstractsyntaxseed.com/blog/regex-engine/nfa-vs-dfa)
