Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

regex check for numbers only js

var ticket = "11122";
var reg = new RegExp('^[0-9]*$');

if (reg.test(ticket)==false) {
  alert('Only Numeric Ticket ID is allowed.');
  return false;
}
Comment

get only numbers regex javascript

var numberPattern = /d+/g;

'something102asdfkj1948948'.match( numberPattern )
Comment

javascript regex number only

let test = "1(919)-723-9378"
console.log(test.replace(/[^d]/g, "")) // output: 19197239378
/D/g     //D is everything not d
/[^d]/g  //d is numerical characters 0-9
/[^0-9]/g //The ^ inside [] means not, so in this case, not numerical characters
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript image xss 
Javascript :: jquery show flex 
Javascript :: process.now() nodejs 
Javascript :: element is hidden jquery 
Javascript :: Code to Unsubscribe all youtube channels. 
Javascript :: javascript json foreach value 
Javascript :: 0.1 + 0.2 javascript 
Javascript :: javascript generate random number based on date 
Javascript :: how to get a randome element from a list in javascript 
Javascript :: jquery get image src 
Javascript :: javascript factorial 
Javascript :: javascript queryselector data attribute 
Javascript :: image next src url 
Javascript :: react router get host js 
Javascript :: javascript select random element from array 
Javascript :: jquery post upload file 
Javascript :: int to string js 
Javascript :: javascript alerter 
Javascript :: javascript group array by key 
Javascript :: javascript string get last two character 
Javascript :: how to use current data in javascript 
Javascript :: javascript modal close 
Javascript :: get form response with javascript 
Javascript :: javascript string to int 
Javascript :: jquery loop through list elements 
Javascript :: TypeError: React__namespace.useSyncExternalStore is not a function in chakraui 
Javascript :: how to copy text in react 
Javascript :: react image wont show 
Javascript :: js is letter 
Javascript :: convert json to base64 javascript 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =