Senin, 14 Februari 2011

Powershell - Powertips: Eliminating Duplicate Words

I get emails from powershell.com that are worth sharing (and remembering). These are not my scripts. Signup for daily PowerTips here: http://powershell.com/cs/.

Let's assume you want to eliminate duplicate words in a text. Here is how you can do this:
'this text text contains duplicate words words following each other' -replace '\b(\w+)(\s+\1){1,}\b', '$1'

0 komentar:

Posting Komentar

 
Powered by Blogger