Question: I have my project link as follows : `http://localhost/prolist_admin/` and I use the move\_uploaded\_file as follows `move_uploaded_file($temp_name, "../assets/img/static/$projectLogo");`

The above code moves my file to the right folder, with the permission set to 777 on that folder.

Now, I want to move the files to a different folder, not the project folder.

for this, I'm having a hard time using `../../../` to navigate there( I don't think it's a good idea either)

Is there a way I can just use something like the following absolute linking `http://localhost/newFolder/$projectLogo` to move the files to a brand new folder, outside the project folder?

Thanks!

Answer: 
```
/[^!$£]/g
```

Replace everything but !, $, and £.

```js
const str = `(?i).*!$abc£`;

const rgx = /[^!$£]/g;

const res = str.replaceAll(rgx, '');

console.log(res);
```
You can use

```js
text = text.replace(/\(\?i\)..([^\w\s:]*)\w+(\W*)/, '$1$2')
// or even
text = text.replace(/\(\?i\)..([^\w\s:]*)\w+/, '$1')

```

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

*Details*:

* `\(\?i\)` - a `(?i)` string
* `..` - any two chars other than line break chars
* `([^\w\s:]*)` - Group 1 (`$1`): zero or more chars other than word, whitespace and `:` chars
* `\w+` - one or more word chars
* `(\W*)` - Group 2: zero or more non-word chars.

The replacement is the concatenation of Group 1 and Group 2.