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.
Asked
Active
Viewed 830 times
3

Martin Prikryl
- 188,800
- 56
- 490
- 992

Petar
- 273
- 1
- 4
- 16
2 Answers
2
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:

Martin Prikryl
- 188,800
- 56
- 490
- 992
-
1Thanks @Martin Prikryl, the king of Inno Setup on Stack Overflow. :) – Petar Nov 20 '18 at 10:55
1
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.

Roman Kruglov
- 3,375
- 2
- 40
- 46