Hi, I would like to know how to assign the value according to an answer.
suppose that the response Source contains the number 123.
so I would like to assign something like this
123 = red
456 = green
789 = yellow
I would like to name a color depending on the number.
Remembering that it is for study purposes on my own website
You could use a block that translates, for example if it finds 123 that translates it as red and so on with the others
That is what I understand ā¦ if not correct me
1 Like
I just have one more question.
Suppose the response source brings me a sequence like this ā1239548757ā
how do i capture only the first 3 numbers?
You can capture with a regular expression(Regex)
what I put in the Regex field and output
In the same way, I will tell you that it depends if your first capture is the same as what you provided me with the ā1239548757ā, - on that you will make a capture in regex and use the translate ā¦
1 Like
thank you very much, i got <3
Nice to know that I have helped you ā¦ have a good day
1 Like
Sorry to bother again, what if I want to capture the last 4 numbers?
Example ā1239548757ā
first three ā 123
last four ā 8757
EdwardN
December 9, 2021, 9:16pm
11
you could use these expressions ā¦ iām not that good at this but i think it might work for you
BLOCK:ConstantString
value = "1239548757"
=> VAR @Mycap
ENDBLOCK
BLOCK:Parse
LABEL:First 3
input = @Mycap
jToken = "Mycap"
pattern = "(\\d{3})"
outputFormat = "[1]"
MODE:Regex
=> CAP @First3
ENDBLOCK
BLOCK:Parse
LABEL:Last 4
input = @Mycap
pattern = "(\\d{6})(\\d{4})"
outputFormat = "[2]"
MODE:Regex
=> VAR @Last4
ENDBLOCK
OPTION 2
BLOCK:Parse
LABEL:Last 4
input = @Mycap
pattern = "((?s)[0-9]{4}$)"
outputFormat = "[1]"
MODE:Regex
=> VAR @Last4
ENDBLOCK
thank you very much. option 2 solved
1 Like