none
-contains doesn't always work as expected RRS feed

  • Question

  • Why does this work

    $($document["Name"].Contains($($csv.DOCUMENT))

    and this doesn't?

    $document["Name"]-contains$($csv.DOCUMENT)

    I'm trying to match the values and can't seem to figure out the right way to filter on this.

    $document["Name"Is from a sharepoint document object. 

    $($csv.DOCUMENT) Is from an imported CSV.


    David Jenkins

    Friday, November 3, 2017 3:19 PM

Answers

  • The -contains operator doesn't mean "does a string contain a substring." It means "does an array have some value in it." Run this command for more information:


    help about_Comparison_Operators
    

    For substring wildcard matches, you can use -like, or if you want to use a regular expression, you can use -match.

    -- Bill Stewart [Bill_Stewart]

    Friday, November 3, 2017 4:00 PM
    Moderator

All replies

  • Match seems to work.

    David Jenkins

    Friday, November 3, 2017 3:28 PM
  • The -contains operator doesn't mean "does a string contain a substring." It means "does an array have some value in it." Run this command for more information:


    help about_Comparison_Operators
    

    For substring wildcard matches, you can use -like, or if you want to use a regular expression, you can use -match.

    -- Bill Stewart [Bill_Stewart]

    Friday, November 3, 2017 4:00 PM
    Moderator