Reputation: 331
Is there some wildcard characters for Inno Setup? I am trying to go through string and if there is some value that I'm searching for, the program should return 1 (I'm using Pos()
function that already does what I need), but my problem here is that the part of string that I'm searching for is not static, so I need some wildcard character like *
that can replace one or more characters.
Upvotes: 3
Views: 1110
Reputation: 202474
There was no pattern matching functionality in Inno Setup Pascal Script until recently. Since 6.1, you can use the WildcardMatch
function (as the answer by @Roman shows).
If you are stuck with an older version, or if you need a custom matching, you can use a function like this:
function AnythingAfterPrefix(S: string; Prefix: string): Boolean;
begin
Result :=
(Copy(S, 1, Length(Prefix)) = Prefix) and
(Length(S) > Length(Prefix));
end;
And use it like:
if AnythingAfterPrefix(S, 'Listing connections...') then
You may want to add TrimRight
to ignore trailing spaces:
if AnythingAfterPrefix(TrimRight(S), 'Listing connections...') then
Similar questions:
Upvotes: 2
Reputation: 3547
According to the documentation there are now
function IsWildcard(const Pattern: String): Boolean;
function WildcardMatch(const Text, Pattern: String): Boolean;
maybe they were added recently. Should do what you needed.
Upvotes: 1