Regular expressions: Difference between revisions

added PowerShell
(add m4)
(added PowerShell)
Line 461:
<lang php> $string = preg_replace('/\ba\b/', 'another', $string);
echo "Found 'a' and replace it with 'another', resulting in this string: $string\n";</lang>
 
=={{header|PowerShell}}==
<lang powershell>"I am a string" -match '\bstr' # true
"I am a string" -replace 'a\b','no' # I am no string</lang>
By default both the <code>-match</code> and <code>-replace</code> operators are case-insensitive. They can be made case-sensitive by using the <code>-cmatch</code> and <code>-creplace</code> operators.
 
=={{header|Python}}==
Anonymous user