Posted On March 28, 2019

match

kimconnect 0 comments

– The match() method retrieves the matches when matching a string against a regular expression. Returns a Array of matches or null of none is found.
– Format: str.match(regex)
– Same as RegExp.exe() if regexp doesn’t have the /g flag
– Example:
var regex = /(.)\1+/g;
var str = “aab”;
console.log(str.match(regex));

logs [ ‘aa’, index: 0, input: ‘aab’ ]

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Excel MD5 Hash Function

Go to the VB editor (Alt-F11), right-click on your workbook in theproject window, and click…

WordPress: How To Add Custom XML Sitemap to Yoast SEO

Step 1: Install Yoast SEO Step 2: Install Code Snippets Step 3: Add this Snippet…

How to Remove Windows Junk via GPO – Chat, Weather, Hello, Shopping

Download and install Administrative Templates (.admx) Windows 11 October 2021 Update [21H2] - https:// www.microsoft.com/en-us/download/details.aspx?id=103507…