Wildcard characters in Inno Setup (test if there is any value after fixed string prefix)
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.
inno-setup pascalscript
add a comment |
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.
inno-setup pascalscript
Do you mean that you want a pattern likeaaa*bbb
? - I.e. you want to test if a string contains bothaaa
andbbb
- in that order.
– Martin Prikryl
Nov 20 '18 at 10:22
No, I want to check if there are any characters after some part of string inside that string. For example, if the string isListing connections...guest 127.0.0.1
, I want to check if there is something afterListing connections...
, and thisguest 127.0.0.1
wont be static, it might change, and in case that it changes I want to check if there is anything after that first part of the string.
– Petar
Nov 20 '18 at 10:28
add a comment |
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.
inno-setup pascalscript
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.
inno-setup pascalscript
inno-setup pascalscript
edited Nov 20 '18 at 12:02
Martin Prikryl
88.1k22171373
88.1k22171373
asked Nov 20 '18 at 9:46
PetarPetar
588
588
Do you mean that you want a pattern likeaaa*bbb
? - I.e. you want to test if a string contains bothaaa
andbbb
- in that order.
– Martin Prikryl
Nov 20 '18 at 10:22
No, I want to check if there are any characters after some part of string inside that string. For example, if the string isListing connections...guest 127.0.0.1
, I want to check if there is something afterListing connections...
, and thisguest 127.0.0.1
wont be static, it might change, and in case that it changes I want to check if there is anything after that first part of the string.
– Petar
Nov 20 '18 at 10:28
add a comment |
Do you mean that you want a pattern likeaaa*bbb
? - I.e. you want to test if a string contains bothaaa
andbbb
- in that order.
– Martin Prikryl
Nov 20 '18 at 10:22
No, I want to check if there are any characters after some part of string inside that string. For example, if the string isListing connections...guest 127.0.0.1
, I want to check if there is something afterListing connections...
, and thisguest 127.0.0.1
wont be static, it might change, and in case that it changes I want to check if there is anything after that first part of the string.
– Petar
Nov 20 '18 at 10:28
Do you mean that you want a pattern like
aaa*bbb
? - I.e. you want to test if a string contains both aaa
and bbb
- in that order.– Martin Prikryl
Nov 20 '18 at 10:22
Do you mean that you want a pattern like
aaa*bbb
? - I.e. you want to test if a string contains both aaa
and bbb
- in that order.– Martin Prikryl
Nov 20 '18 at 10:22
No, I want to check if there are any characters after some part of string inside that string. For example, if the string is
Listing connections...guest 127.0.0.1
, I want to check if there is something after Listing connections...
, and this guest 127.0.0.1
wont be static, it might change, and in case that it changes I want to check if there is anything after that first part of the string.– Petar
Nov 20 '18 at 10:28
No, I want to check if there are any characters after some part of string inside that string. For example, if the string is
Listing connections...guest 127.0.0.1
, I want to check if there is something after Listing connections...
, and this guest 127.0.0.1
wont be static, it might change, and in case that it changes I want to check if there is anything after that first part of the string.– Petar
Nov 20 '18 at 10:28
add a comment |
1 Answer
1
active
oldest
votes
There's no pattern matching functionality in Inno Setup Pascal Script.
But 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
Thanks @Martin Prikryl, the king of Inno Setup on Stack Overflow. :)
– Petar
Nov 20 '18 at 10:55
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53390206%2fwildcard-characters-in-inno-setup-test-if-there-is-any-value-after-fixed-string%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
There's no pattern matching functionality in Inno Setup Pascal Script.
But 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
Thanks @Martin Prikryl, the king of Inno Setup on Stack Overflow. :)
– Petar
Nov 20 '18 at 10:55
add a comment |
There's no pattern matching functionality in Inno Setup Pascal Script.
But 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
Thanks @Martin Prikryl, the king of Inno Setup on Stack Overflow. :)
– Petar
Nov 20 '18 at 10:55
add a comment |
There's no pattern matching functionality in Inno Setup Pascal Script.
But 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
There's no pattern matching functionality in Inno Setup Pascal Script.
But 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
answered Nov 20 '18 at 10:40
Martin PrikrylMartin Prikryl
88.1k22171373
88.1k22171373
Thanks @Martin Prikryl, the king of Inno Setup on Stack Overflow. :)
– Petar
Nov 20 '18 at 10:55
add a comment |
Thanks @Martin Prikryl, the king of Inno Setup on Stack Overflow. :)
– Petar
Nov 20 '18 at 10:55
Thanks @Martin Prikryl, the king of Inno Setup on Stack Overflow. :)
– Petar
Nov 20 '18 at 10:55
Thanks @Martin Prikryl, the king of Inno Setup on Stack Overflow. :)
– Petar
Nov 20 '18 at 10:55
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53390206%2fwildcard-characters-in-inno-setup-test-if-there-is-any-value-after-fixed-string%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Do you mean that you want a pattern like
aaa*bbb
? - I.e. you want to test if a string contains bothaaa
andbbb
- in that order.– Martin Prikryl
Nov 20 '18 at 10:22
No, I want to check if there are any characters after some part of string inside that string. For example, if the string is
Listing connections...guest 127.0.0.1
, I want to check if there is something afterListing connections...
, and thisguest 127.0.0.1
wont be static, it might change, and in case that it changes I want to check if there is anything after that first part of the string.– Petar
Nov 20 '18 at 10:28