Forum Discussion

Adagio's avatar
Adagio
Frequent Contributor
7 years ago

How to extract a string from between 2 other repeating strings

Hi,   This problem has been bothering me for sometime now. Could someone please help?   As shown in the snapshot below, I have to extract 0028441622 from this text on the picture. I'm able to rea...
  • karkadil's avatar
    7 years ago

    Such tasks can usually be easy solved with the help of replace/split/join methods.

    Here is your specific task solved in JScript:

    var s = 'SOME TEXT\nItem Description:\nSOME OTHER TEXT\nINT:SOME TEXT AGAIN\niLPN:\n0028441622\niLPN:SOME TEXT AT THE END';
      
    var iLPN = s.replace('\n', '').split('iLPN:')[1];
    Log.Message(iLPN);