5,321
edits
No edit summary |
|||
Line 10: | Line 10: | ||
[https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions MDN Guide] | [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions MDN Guide] | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
const myRegex = /(\d+),(\d+)/; | |||
const myStr = "124,52"; | |||
const match = myStr.match(myRegex); | |||
// Captures | // Captures | ||
console.log(match[1], match[2]); | console.log(match[1], match[2]); |