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
Nesta página do site você pode assistir ao vídeo on-line JavaScript Regular Expressions Part4 - JavaScript Tutorial 91 duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário ChidresTechTutorials 27 Janeiro 2022, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 863 vezes e gostou 27 espectadores. Boa visualização!