<p>In PowerShell I'm reading in a text file. I'm then doing a Foreach-Object over the text file and am only interested in the lines that do NOT contain strings that are in <code>$arrayOfStringsNotInterestedIn</code>.</p>

<p>What is the syntax for this?</p>

<pre><code>   Get-Content $filename | Foreach-Object {$_}
</code></pre>

[{'answer_id': 75034, 'author': 'Mark Schill', 'author_id': 9482, 'author_profile': 'https://Stackoverflow.com/users/9482', 'pm_score': 4, 'selected': False, 'text': "<p>You can use the -notmatch operator to get the lines that don't have the characters you are interested in. </p>\n\n<pre><code>     Get-Content $FileName | foreach-object { \n     if ($_ -notmatch $arrayofStringsNotInterestedIn) { $) }\n</code></pre>\n"}, {'answer_id': 75091, 'author': 'Chris Bilson', 'author_id': 12934, 'author_profile': 'https://Stackoverflow.com/users/12934', 'pm_score': 7, 'selected': True, 'text': '<p>If $arrayofStringsNotInterestedIn is an [array] you should use -notcontains:</p>\n\n<pre><code>Get-Content $FileName | foreach-object { `\n   if ($arrayofStringsNotInterestedIn -notcontains $_) { $) }\n</code></pre>\n\n<p>or better (IMO)</p>\n\n<pre><code>Get-Content $FileName | where { $arrayofStringsNotInterestedIn -notcontains $_}\n</code></pre>\n'}, {'answer_id': 143727, 'author': 'Bruno Gomes', 'author_id': 8669, 'author_profile': 'https://Stackoverflow.com/users/8669', 'pm_score': 2, 'selected': False, 'text': "<p>To exclude the lines that contain any of the strings in $arrayOfStringsNotInterestedIn, you should use:</p>\n\n<pre><code>(Get-Content $FileName) -notmatch [String]::Join('|',$arrayofStringsNotInterestedIn)\n</code></pre>\n\n<p>The code proposed by Chris only works if $arrayofStringsNotInterestedIn contains the full lines you want to exclude.</p>\n"}]
['https://Stackoverflow.com/questions/74957', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1463/']