How to extract a specific value from a text?

I am getting the following text from a third party API call. I am looking to extract only the credit card number and the cardholder name from it. How can I make this happen in Appian? Is there any function that could help?

"BBVA
Rewards
4000 1234 5678 9010
12/20
VALID
THRU
VISA
JOSE MARIA SANCHEZ"

Parents
  • Two suggestions for a start:

    1) if the API call will always return data in the exact same format (i.e. always the same number of lines where the same line always has the same info, line 3 = card number, etc) -- use the split() function like split(local!returnText, char(10)), which will give you an array where the credit card number is local!array[3] and the card holder name will be local!array[8] for example.

    2) if there might be a little bit of variability to the number of lines, but the data is at least always in the same order, you could also use the extract() function, which will let you extract, for example, everything between "Rewards" and "VALID", or between "VISA" and the end of the string.

Reply
  • Two suggestions for a start:

    1) if the API call will always return data in the exact same format (i.e. always the same number of lines where the same line always has the same info, line 3 = card number, etc) -- use the split() function like split(local!returnText, char(10)), which will give you an array where the credit card number is local!array[3] and the card holder name will be local!array[8] for example.

    2) if there might be a little bit of variability to the number of lines, but the data is at least always in the same order, you could also use the extract() function, which will let you extract, for example, everything between "Rewards" and "VALID", or between "VISA" and the end of the string.

Children

 Discussion posts and replies are publicly visible