Wildcard characters in Inno Setup (test if there is any value after fixed string prefix)












1















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.










share|improve this question

























  • 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
















1















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.










share|improve this question

























  • 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














1












1








1


1






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.










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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



















  • 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

















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












1 Answer
1






active

oldest

votes


















1














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





share|improve this answer
























  • Thanks @Martin Prikryl, the king of Inno Setup on Stack Overflow. :)

    – Petar
    Nov 20 '18 at 10:55













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
});


}
});














draft saved

draft discarded


















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









1














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





share|improve this answer
























  • Thanks @Martin Prikryl, the king of Inno Setup on Stack Overflow. :)

    – Petar
    Nov 20 '18 at 10:55


















1














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





share|improve this answer
























  • Thanks @Martin Prikryl, the king of Inno Setup on Stack Overflow. :)

    – Petar
    Nov 20 '18 at 10:55
















1












1








1







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





share|improve this answer













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






share|improve this answer












share|improve this answer



share|improve this answer










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





















  • 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






















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

ComboBox Display Member on multiple fields

Is it possible to collect Nectar points via Trainline?