Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to check if a string is alphabetic in javascript

function isAlphaOrParen(str) {
  return /^[a-zA-Z()]+$/.test(str);
}

/*/^[a-zA-Z()]*$/ - also returns true for an empty string
/^[a-zA-Z()]$/ - only returns true for single characters.
/^[a-zA-Z() ]+$/ - also allows spaces*/
//better regEX to include question marks too
Comment

check for alphabetic string in javascript

function isAlphaOrParen(str) {
  return /^[a-zA-Z()]+$/.test(str);
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: mil to km javascript 
Javascript :: split string in angular 8 
Javascript :: vue 3 computed getter setter 
Javascript :: discord delete messag 
Javascript :: res.status 
Javascript :: mat checkbox change event in angular 7 
Javascript :: javascript orderby 
Javascript :: how to set dropdown value in jquery 
Javascript :: mock a function jest react 
Javascript :: js random word generator 
Javascript :: javascript validate email 
Javascript :: push characters to a string javascript 
Javascript :: async setstate useeffect 
Javascript :: copy to clipboard javascript dom 
Javascript :: on function change body background image 
Javascript :: Getting Binary gap in JS 
Javascript :: javascript open new window with html content 
Javascript :: reverse every word 
Javascript :: dockerfile copy ignore node_modules 
Javascript :: factorial javascript 
Javascript :: javascript get image width and height 
Javascript :: get elements by class is not working 
Javascript :: create array with number js 
Javascript :: how to remove identical string in javascript 
Javascript :: jquery selector exists 
Javascript :: jsconfig for default vue 
Javascript :: moment check greater than current time 
Javascript :: using map in useeffect 
Javascript :: export default new class in es6 
Javascript :: method to look for objects in arrays by id 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =