Export function

后端 未结 2 1319
花落未央
花落未央 2021-01-26 14:06

I am trying to create a function in which a user has to give a filename that can not containt an empty string. Besides that, the string can not contain a dot. When I run this fu

2条回答
  •  后悔当初
    2021-01-26 14:45

    Use this to test your input:

    !($script:newLog.contains('.')) -and !([String]::IsNullOrEmpty($script:newLog)) -and !([String]::IsNullOrWhiteSpace($script:newLog))

    Your regular expression (-match ".*" is essentially matching on everything.

提交回复
热议问题