Wildcard for IF-command - solved

Started by Birdman, March 20, 2023, 12:14:15 PM

Previous topic - Next topic

Birdman

Hello,

as I leraned a while ago the dot "." is a wildcard for a single character at a specific place. What would be a wildcard for an unknown number of characters? For the tag "Flash" I would like to write an IF-command which would be true for several different variations. Instead of
-if "$flash eq 'Fired, Red-eye reduction'"I would like to use a shorter version like
-if "$flash eq 'Fired.*'"The Dot-Star combination does not seem to work.

Edit: Solved it:
-if "$flash=~/.*Fired.*/"
Best regards,

Martin (Birdman)

Phil Harvey

To expand:

. = any single character
.? = 0 or 1 characters
.* = 0 or more characters
.+ = 1 or more characters
.{N} = N characters (N is any integer)
.{N,} = at least N characters
.{N,M} = at least N characters but not more than M characters

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).