Notes for You:: JavaScript Regular Expressions Part4 - JavaScript Tutorial 91
JavaScript RegExp Starts and Ends with
Sequence of characters enclosed in between pair of forward slash symbols indicates a regular expression in JavaScript
Syntax for defining a variable of type regular expression is:
var variableName = /search pattern/ [flags] ;
Ex: validating a phone number
var pattern = / ^[0-9]{10}$ /;
Begins with & Ends with Meta characters:
are used to test whether a string begins with a specific pattern and/or ends with specific pattern
Ex:
^a
indicates whether a string begins with a character
a$
indicates whether a string ends with a character
Example Code:
document.write( /^A/.test("Agent007 is the best agent") ); // true
document.write( /^A/.test("Bgent007 is the best agent") ); // false
document.write( /^Agent/.test("Agent007 is the best agent") ); // true
document.write( /^Agent007/.test("Agent007 is the best agent") ); // true
document.write( /^Agent007/.test("Agent008 is the best agent") ); // false
document.write( /7$/.test("I am Agent007") ); // true
document.write( /7$/.test("I am Agent008") ); // false
document.write( /Agent007$/.test("I am Agent007") ); // true
document.write( /Agent007$/.test("I am Agent008") ); // false
document.write( /^Agent007$/.test("Agent007") ); // true
document.write( /^Agent007$/.test("Agen-t007") ); // false
=========================================
Follow the link for next video:
JavaScript Tutorial 92 - Quantifiers in Regular Expression JavaScript
• JavaScript Regular Expressions Part5 ...
Follow the link for previous video:
JavaScript Tutorial 90 - Regular Expression Meta Characters in JavaScript
• JavaScript Regular Expressions Part3 ...
=========================================
JavaScript Tutorials Playlist:-
• JavaScript Tutorials
=========================================
Watch My Other Useful Tutorials:-
jQuery Tutorials Playlist:-
• jQuery Tutorials
jQuery UI Tutorials Playlist:-
• jQuery UI Tutorials
Bootstrap Tutorials Playlist:-
• Bootstrap4 Tutorials
=========================================
► Subscribe to our YouTube channel:
/ chidrestechtutorials
► Visit our Website:
https://www.chidrestechtutorials.com
=========================================
Hash Tags:-
#ChidresTechTutorials #JavaScript #JavaScriptTutorial
На этой странице сайта вы можете посмотреть видео онлайн JavaScript Regular Expressions Part4 - JavaScript Tutorial 91 длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь ChidresTechTutorials 27 Январь 2022, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 863 раз и оно понравилось 27 зрителям. Приятного просмотра!