## case sensitive with whole word matching
"alpha Beta gammedelta delta" -creplace "\bdelta\b","epsilon"
## using capture groups , with sample text
## $ServicePascalCase = "Patients"
## $ObjectInSentenceCase = "Patient Phone"
## $PluralCamelCase = "patientPhones"
# To capture the '$ServicePascalCase' before the =
gcb | % { $_ -replace "(\w+) = .*", "`$1" }
# This also works but shows how to escape the $ sign.
# It is escaped differently in the regex match vs the regex replace
gcb | % { $_ -replace "(\$\w+) = .*", "`$1" }
## trims the last entry which seems to be blank in a list of things
gcb | ? { $_ -match "(\w+)" } | % { $Matches[0] }
##
((gcb) -split ',' | % { $_ -match "Treatment\w+" |out-null ; $Matches[0] } | % { "`\`"{treatment.$($_)}`\`"" } ) -join ',' | clip