Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

RegExp

const text = 'Образец text на русском языке';
const regex = /[u0400-u04FF]+/g;

const match = regex.exec(text);
console.log(match[0]); // logs 'Образец'
console.log(regex.lastIndex); // logs '7'

const match2 = regex.exec(text);
console.log(match2[0]); // logs 'на' [did not log 'text']
console.log(regex.lastIndex); // logs '15'

// and so on
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #RegExp
ADD COMMENT
Topic
Name
7+4 =