# Script to replace regex matches

**URL:** <https://forums.powershell.org/t/script-to-replace-regex-matches/13369>\
**Category:** PowerShell Help\
**Created:** [November 4, 2019, 9:48am UTC](https://forums.powershell.org/t/script-to-replace-regex-matches/13369 "2019-11-04T09:48:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![a11](https://avatars.discourse-cdn.com/v4/letter/a/b77776/32.png) [@a11](https://forums.powershell.org/u/a11)\
**Post date:** [November 4, 2019, 9:48am UTC](https://forums.powershell.org/t/script-to-replace-regex-matches/13369/1 "2019-11-04T09:48:38Z")

</div>

Hello

Can you guide me please step-by-step to a script that will replace specific regex matches in a file?

From loading the file, to read it, to performing the regex search, to replacing the text, to save the changed file.

Thanks!

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [November 4, 2019, 11:11am UTC](https://forums.powershell.org/t/script-to-replace-regex-matches/13369/2 "2019-11-04T11:11:00Z")

</div>

Hello A21,

I think it is beyond the scope of this (or any) forum to teach you step by step how to write a script. Please take the first steps by yourself and use a beginner book or an online tutorial to start to learn the very basics of Powershell.

Good luck and have a lot of fun.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:31pm UTC](https://forums.powershell.org/t/script-to-replace-regex-matches/13369/3 "2024-05-16T20:31:39Z")

</div>


