Introduction
A RegExp() is an object that describes a pattern with which text can be matched.
When describing a new pattern we need to define two things in our code.1.pattern: A text that specifies the pattern of the regular expression.2.attributes: An optional string containing any of the "g","i", and "m" attributes that specify multiple, case-insensitive, and multi line matches, respectively.
So a valid regex pattern may be described in the format: https://raw.githubusercontent.com/finsweet/jqueryCourse/main/jsobjects/ex1.js?actionable=false Here, the pattern variable is the text that specifies the pattern of the regular expression.
The following code will match any character from lowercase a to lower case z. 'g' is used for multiple matches to be possible: https://raw.githubusercontent.com/finsweet/jqueryCourse/main/jsobjects/ex2.js?actionable=true
$(document).ready(function(){
XT1
});
</script>
Live demo
<div id="minidivpage" class="example-live"><div id="textblock">Lorem [email protected] ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim [email protected] veniam, quis nostrud exercitation ullamco laboris nisi [email protected] ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu [email protected] fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div></div>
$(document).ready(function() {
XT1
});
</script>