Javascript matching: Difference between revisions

From wikinotes
No edit summary
 
Line 5: Line 5:


<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
"abcdefg".match(/def/) // true/false
"aaabbbccc".match(/bbb/)       // true/false
"aaabbbccc".replace(/b/, "d")  // "aaadddccc"
</syntaxhighlight>
</syntaxhighlight>
</blockquote><!-- RegExp -->
</blockquote><!-- RegExp -->

Latest revision as of 23:01, 4 February 2023

RegExp

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp

"aaabbbccc".match(/bbb/)       // true/false
"aaabbbccc".replace(/b/, "d")  // "aaadddccc"