Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

regex capture group example

let str = '<h1>Hello, world!</h1>';

let tag = str.match(/<(.*?)>/);

alert( tag[0] ); // <h1>
alert( tag[1] ); // h1
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #regex #capture #group
ADD COMMENT
Topic
Name
8+4 =