Remove Non-Numeric in Javascript

#1. Method One Use the string’s .replace the method with a regex of \D, The RegExp \D Metacharacter is used to search non-digit characters. Which is a replace all non-digits characters: Result: #2. Method Two Use a regular expression to replace all non-numeric characters from a string. Something like: The [^0-9] expression is used to find any character that … Read more

Check If a String Contains Only Numbers in Javascript

In this blog post, we learn how to check or validate a string containing only numbers. Often this validation is used to validate the phone number. 1. First Method using RegExp \D To validate I am using RegExp \D Metacharacter. The \D metacharacter matches non-digit characters. “isNum” variable returns a true or false. Result 2. Second Method using … Read more

Remove Non Alphanumeric in Javascript

In this post, We learn how to remove Non-alphanumeric characters from a string in javascript. What are non alphanumeric characters? Non-alphanumeric characters are those characters or kinds of symbols. Such as exclamation mark(!), at symbol(@), commas(, ), question mark(?), colon(:), dash(-) etc and special characters like dollar sign($), equal symbol(=), plus sign(+), apostrophes(‘). 1. Using \w Metacharacter … Read more

How to Make a Keylogger in Javascript?

In this blog post, I share simple javascript code to make Keylogger in Javascript. This simple Js code will record keystrokes from the user on the website page and write a log on log.txt. index.php javascript.js Don’t fotget to add domain in server. We would get the final result like this. log.txt