Extract number pattern from raw string using javascript -
currently have string eg:
--3c8a15bdc66e76b5 content-type: text/plain x-primitive: integer 8487823278258687528 --3c8a15bdc66e76b5-- --3c8a15bdc66e76b5 content-type: text/plain x-primitive: integer 14918370877051183774 --3c8a15bdc66e76b5--
from above string want extract:
8487823278258687528,14918370877051183774
number string raw string , want save in array , using javascript.
kindly on same. great help. i'm new programming
do want this
let str = '--3c8a15bdc66e76b5 content-type: text/plain x-primitive: integer 8487823278258687528 --3c8a15bdc66e76b5-- --3c8a15bdc66e76b5 content-type: text/plain x-primitive: integer 14918370877051183774 --3c8a15bdc66e76b5-- .' console.log(str.match(/\b\d+\b/g));
this match numbers using regex
\b\d+\b
here \b defines boundary \d+ matches numbers atleast 1 num in it
Comments
Post a Comment