0

I have a script that search a mail body.

in the mail body a get a list of ID's like below: Batch: yt166161 Section:567-947 Sys_id: 1234 Sys_id: 6543 Sys_id: 0974

I need to extract only the number after the Sys_id: and put the in an array.

I'm working on JavaScript

1 Answers1

0

You can use the regex /[0-9]+/gm to extract the number.

ex:

const str = 'Sys_id: 1234 Sys_id: 6543 Sys_id: 0974';
const regex = /[0-9]+/gm;
const matches = str.match(regex);
console.log(matches);

output: [ "1234" , "6543" , "0974" ]

neer2005
  • 54
  • 4
  • thanks for your rapid response. but i need only the numbers after the "sys_id:" string. in the mail there are more information (with others strings and numbers). – Marcelo List Oct 27 '21 at 17:48