PowerShell | Match Partial String
Input: @Display(Model.Header) (Orchard zone btw) Output: Header Solution: $zoneName = [regex]::Replace(".*@Display(Model.Header).*", "@Display\(Model.([A-Za-z]*).*?\)", "`$1") Obs: - ( and ) literals need to be escaped with \ - using (some text) in powershell enables reusing the matched string inside with $1, $2, $3, etc - Should use "`$1" or '$1' - .* removes all text before and after matched string