Contents:-
Regular expression methods
1. test
2. exec
Using the regex methods
1. replace
174. Write a program to remove all special characters from the given string.
let a = "trints tech3 986 axy 786 %%%%$$$$$###";
Output: trints tech3 986 axy 786
175. Write a program to remove all characters other than a-zA-Z from the given string.
let a = "trints tech3 986 axy 786 %%%%$$$$$###";
Output: trints tech axy
176. Write a program to remove all characters other than numbers from the given string.
let a = "trints tech3 986 axy 786 %%%%$$$$$###";
Output: 3 986 786
177. Write a program to find all the numbers from the given string and calculate the sum.
let a = "trints tech3 986 axy 786 %%%%$$$$$###";
Output: 3+986+786 = 1775
178. Check the given string has atleast one number. If number available then return true.
let a = "trints tech3 986 axy 786 %%%%$$$$$###";
Output: true
179. Check the given string has atleast one Capital letter. If available then return true.
let a = "trints tech3 986 axy 786 %%%%$$$$$###";
Output: false
180. Check the given string has atleast one letter and number. If available then return true.
let a = "trints tech3 986 axy 786 %%%%$$$$$###";
Output: true
On this page of the site you can watch the video online Part 20 | JavaScript Tutorial | Regular expressions in JavaScript | Regex | Test | Exec | Replace with a duration of hours minute second in good quality, which was uploaded by the user Trinits Technologies 01 March 2023, share the link with friends and acquaintances, this video has already been watched 103 times on youtube and it was liked by 2 viewers. Enjoy your viewing!