Question: I want to convert

```
http://website.com/cat/movie/nameofmovie.html

```

to this

```
http://website.com/cat/movie

```

So I have tried `[/].*(html)` But this applied from first `/` char, Is there any way to specify 5th `/` in the line?
Is there any method to inverse replace?

Answer: 
If you want to specifically remove everything after the 5th `/` and removing this 5th slash, you can use:

```
((?:[^/]*/[^/]*){4})/.*html

```

And replace with `$1`.

---

If you want to remove the last part of the link with the last slash, you can use:

```
/[^/]+html

```

And here since you don't have any capturing group, leave the replace with box blank.
Try to replace directly `/\w+\.html` with nothing.