I have a regular expression that works perfectly in Sublime text, or other text editors, and it does exactly what I need it to do.
Here is the regular expression
(?sm),"([\w\W]*?)Date completed:
The problem is, in PowerShell, it just doesn't do anything.
This is my little script
$text = Get-Content c:\Tools\export.csv
$text -replace '(?sm),"([\w\W]*?)Date completed: ','REPLACED' | Out-File output.csv
If I replace the regular expression by plain text, it works great. So what is it that it does not like in my regular expression?
Thanks!
'(?sm),"([\w\W]*?)Date completed: 'it is expecting a comma and double quote which I don't think exists in your source data that you are not including here. More impotantly you need to change you$textto be a single string if you expect to use the single and multi mode.$text = Get-Content c:\Tools\export.csv | out-string... im just doing to write and answer.