Article

Introduction

https://cdn.jsdelivr.net/npm/[email protected]/dist/js.cookie.min.js
Copy to clipboard

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

<script>
$(document).ready(function(){
  XT1
});
</script>
Copy to clipboard
Send to Live Demo

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>

<script>    
$(document).ready(function() {
  XT1
});
</script>
<script>
  
</script>
Copy to clipboard
Press the Run Demo button to execute the scripts above.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Your browser is too small

Resize your browser to be at least 769px wide.