Difference between revisions of "PowerShell Comparison Operators"

From rbachwiki
Jump to navigation Jump to search
Line 1: Line 1:
<h2>Equality</h2>
<h2>Equality</h2>
<div>
 
*-eq, -ieq, -ceq - equals
*-eq, -ieq, -ceq - equals
*-ne, -ine, -cne - not equals
*-ne, -ine, -cne - not equals
Line 7: Line 7:
*-lt, -ilt, -clt - less than
*-lt, -ilt, -clt - less than
*-le, -ile, -cle - less than or equal
*-le, -ile, -cle - less than or equal
</div>
Matching


-like, -ilike, -clike - string matches wildcard pattern
<h2>Matching</h2>
-notlike, -inotlike, -cnotlike - string doesn't match wildcard pattern
 
-match, -imatch, -cmatch - string matches regex pattern
*-like, -ilike, -clike - string matches wildcard pattern
-notmatch, -inotmatch, -cnotmatch - string doesn't match regex pattern
*-notlike, -inotlike, -cnotlike - string doesn't match wildcard pattern
Replacement
*-match, -imatch, -cmatch - string matches regex pattern
*-notmatch, -inotmatch, -cnotmatch - string doesn't match regex pattern
 
<h2>Replacement</h2>
 
*-replace, -ireplace, -creplace - replaces strings matching a regex pattern


-replace, -ireplace, -creplace - replaces strings matching a regex pattern
<h2>Containment</H2>
Containment


-contains, -icontains, -ccontains - collection contains a value
*-contains, -icontains, -ccontains - collection contains a value
-notcontains, -inotcontains, -cnotcontains - collection doesn't contain a value
*-notcontains, -inotcontains, -cnotcontains - collection doesn't contain a value
-in - value is in a collection
*-in - value is in a collection
-notin - value isn't in a collection
*-notin - value isn't in a collection
Type
<H2>Type</H2>


-is - both objects are the same type
*-is - both objects are the same type
-isnot - the objects aren't the same type
*-isnot - the objects aren't the same type

Revision as of 18:38, 17 October 2024

Equality

  • -eq, -ieq, -ceq - equals
  • -ne, -ine, -cne - not equals
  • -gt, -igt, -cgt - greater than
  • -ge, -ige, -cge - greater than or equal
  • -lt, -ilt, -clt - less than
  • -le, -ile, -cle - less than or equal

Matching

  • -like, -ilike, -clike - string matches wildcard pattern
  • -notlike, -inotlike, -cnotlike - string doesn't match wildcard pattern
  • -match, -imatch, -cmatch - string matches regex pattern
  • -notmatch, -inotmatch, -cnotmatch - string doesn't match regex pattern

Replacement

  • -replace, -ireplace, -creplace - replaces strings matching a regex pattern

Containment

  • -contains, -icontains, -ccontains - collection contains a value
  • -notcontains, -inotcontains, -cnotcontains - collection doesn't contain a value
  • -in - value is in a collection
  • -notin - value isn't in a collection

Type

  • -is - both objects are the same type
  • -isnot - the objects aren't the same type