E
Ewout
In a regex, I want to use some characters from a string that is
supplied as a kind of parameter value. I will give an example to
explain this.
Assume that the parameter value is ABCR. The regex should be such that
for example a string like ABCC should give a match. But if the
parameter value is XYZR, then the string XYZC should give a match. To
summarize: the regex should take part of the pattern from another
string that is supplied separately from the regex. Is there any way to
achieve this?
I have been thinking about the possibility to do some kind of
preprocessing on the regex pattern. For example, I might state that a
string pattern like **2** will take the character on the second
position of the parameter string. In the above example, the string
pattern would be **1****2****3**C (or maybe **1,2,3**C). After doing
the necessary substitutions, I would then present the resulting
(regular!) regex pattern to a regex compiler. Would this be a sound
approach?
For your information: I am programming in ILE RPG on an iSeries
system. I am not at all familiar with Perl etcetera.
Thanks in advance.
Ewout
supplied as a kind of parameter value. I will give an example to
explain this.
Assume that the parameter value is ABCR. The regex should be such that
for example a string like ABCC should give a match. But if the
parameter value is XYZR, then the string XYZC should give a match. To
summarize: the regex should take part of the pattern from another
string that is supplied separately from the regex. Is there any way to
achieve this?
I have been thinking about the possibility to do some kind of
preprocessing on the regex pattern. For example, I might state that a
string pattern like **2** will take the character on the second
position of the parameter string. In the above example, the string
pattern would be **1****2****3**C (or maybe **1,2,3**C). After doing
the necessary substitutions, I would then present the resulting
(regular!) regex pattern to a regex compiler. Would this be a sound
approach?
For your information: I am programming in ILE RPG on an iSeries
system. I am not at all familiar with Perl etcetera.
Thanks in advance.
Ewout