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

Windows XP – Joining Domain

START > CONTROL PANEL > NETWORK AND INTERNET CONNECTIONS CREATE A CONNECITON TO THE NETWORK…

Setup LAMP using RedHat 7

// Add a new user and set it with root privileges: sudo su useradd {root-user}…

CentOS System Rescue on AWS

Once upon a 'right-now' time, an EC2 instance on AWS would not come back online…