Question: I want to match and expression that contains the string `yes`, but only if it's not preceded by the string `no`.

For example, this with match:
`Hello world, major yes here!`  

But this will not match: `Hell no yes`

The second string does not match because the `yes` string is preceded by `no` string. Apparently this needs negated lookbehind, which is not implemented in JavaScript regex flavor, I've tried stuff like that:
`/((?!no ))yes/`  

`/^(?!.*no) yes$/`

but they don't seem to have the desired effect :/

Answer: 
I don't think there is a need of regex here. You can just do it like this

```
var str = "Hell no yes", match = null, no = str.indexOf("no"), yes = str.indexOf("yes");
if(no >= 0 && (yes < 0 || no < yes)) { // check that no doesn't exist before yes
   match = str.match(/yes/)[0]; // then match the "yes"
}

```
This should work for you:

```
var reg = /^((?!no).)*yes.*$/

console.log("Test some no and yes".match(reg))
console.log("Test some yes".match(reg))
console.log("Test some yes and no".match(reg))

```

Just note that it wont work in sentences where there is no "yes" word like this:

```
console.log("Test some without".match(reg))

```

---

Here is reference that might help more about problem:

[Regular expression to match string not containing a word?](https://stackoverflow.com/a/406408)