Answers for "regular expression one uppercase letter js"

0

regex only uppercase letters js

if (value.match(/^[A-Z]*$/)) {
    // matches
} else {
    // doesn't match
}
Posted by: Guest on October-28-2020
1

js reg expression pick uppercase

const str = "HERE'S AN UPPERCASE PART of the string";
const upperCaseWords = str.match(/(\b[A-Z][A-Z]+|\b[A-Z]\b)/g);
// => [ 'HERE', 'S', 'AN', 'UPPERCASE', 'PART' ]
/*\b - start of the word
  [A-Z] - Any character between capital A and Z
  [A-Z]+ - Any character between capital A and Z, 
   but for one of more times and without interruption
  | - OR
  \b - start of the word
  [A-Z] - Any character between capital A and Z
  \b - end of the word
  g - global (run multiple times till string ends, 
      not just for one instance)*/
Posted by: Guest on August-19-2021

Code answers related to "regular expression one uppercase letter js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language