REGEX-Escape for: New-Item -ItemType Directory -Path .\projects\$1\src Get-ChildItem -Path "...

Your Input:
Result, the escaped string:
New\-Item \-ItemType Directory \-Path \.\\projects\\\$1\\src Get\-ChildItem \-Path "\.\\src\\\$1\\" \-Recurse \| Move\-Item \-Destination "\.\\projects\\\$1\\src" New\-Item \-ItemType Directory \-Path \.\\projects\\\$1\\e2e Get\-ChildItem \-Path "\.\\e2e\\\$1\\" \-Recurse \| Move\-Item \-Destination "\.\\projects\\\$1\\e2e"

What must the escaping look like for:
New-Item -ItemType Directory -Path .\projects\$1\src Get-ChildItem -Path ".\src\$1\" -Recurse | Move-Item -Destination ".\projects\$1\src" New-Item -ItemType Directory -Path .\projects\$1\e2e Get-ChildItem -Path ".\e2e\$1\" -Recurse | Move-Item -Destination ".\projects\$1\e2e"

The excaped text for use in a regex is:
New\-Item \-ItemType Directory \-Path \.\\projects\\\$1\\src Get\-ChildItem \-Path "\.\\src\\\$1\\" \-Recurse \| Move\-Item \-Destination "\.\\projects\\\$1\\src" New\-Item \-ItemType Directory \-Path \.\\projects\\\$1\\e2e Get\-ChildItem \-Path "\.\\e2e\\\$1\\" \-Recurse \| Move\-Item \-Destination "\.\\projects\\\$1\\e2e"


Ads