<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Simon Chukwuebuka </title>
    <description>The latest articles on DEV Community by Simon Chukwuebuka  (@cebuka).</description>
    <link>https://dev.to/cebuka</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F624528%2F58a9f82f-b39f-463c-a77c-29c3831eaa7a.jpg</url>
      <title>DEV Community: Simon Chukwuebuka </title>
      <link>https://dev.to/cebuka</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cebuka"/>
    <language>en</language>
    <item>
      <title>React vs Flutter</title>
      <dc:creator>Simon Chukwuebuka </dc:creator>
      <pubDate>Sun, 30 Jun 2024 14:36:59 +0000</pubDate>
      <link>https://dev.to/cebuka/react-vs-flutter-1mac</link>
      <guid>https://dev.to/cebuka/react-vs-flutter-1mac</guid>
      <description>&lt;p&gt;Getting into the field of frontend web development can be exciting and at the same confusing. Here you'll discover that there are myriads of tools to get the job done. The thought of what tool to use can become a hindrance to productivity.In this article, we compare and contrast two well-known web technology tools; Reactjs and Flutter.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is React?
&lt;/h2&gt;

&lt;p&gt;ReactJs or React is a javascript library that was built and is maintained by Facebook. It makes use of components(individual pieces of code) to build user interfaces. It is best used in building SPAs(Single Page Applications).&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Flutter?
&lt;/h2&gt;

&lt;p&gt;Flutter is a framework developed by Google for building native applications from a single codebase. It uses the Dart programming language.Flutter is used to build mobile applications but is also used in building desktop applications and web apps.&lt;/p&gt;

&lt;h2&gt;
  
  
  React Or Flutter 😕 ?
&lt;/h2&gt;

&lt;p&gt;Well, suffice it to say it depends on the usecase. Each one of them is tailored towards solving a peculiar problem. For instance, React is best suited for web applications. This does not mean it cannot for mobile development, in fact, React-Native(used for mobile development) competes with Flutter in this field.&lt;br&gt;
Flutter can best be used when a mobile and a web version of a product is both needed. With flutter, there's no need to rewrite the codebase.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;I know, I know 😃, I barely scratched this topic but you are free to read more on &lt;a href="https://react.dev/"&gt;react&lt;/a&gt; and on &lt;a href="https://docs.flutter.dev/"&gt;flutter&lt;/a&gt;. Truth is, it depends on what tools are best for the particular task at hand. This can be influenced to a large extent by your team's decision. For instance, in a program that I'm a part of; &lt;a href="https://hng.tech/internship"&gt;HNG&lt;/a&gt; internship, ReactJs is the preferred tool. The Program also &lt;a href="https://hng.tech/hire"&gt;hires&lt;/a&gt; frontend developers.&lt;br&gt;
The field of frontend development has myriads of tools that sometimes do the same thing or sometimes tailored to a particular task. It's up to you as a developer to choose from these tools what you need.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>flutter</category>
      <category>react</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Regex in JS Explained</title>
      <dc:creator>Simon Chukwuebuka </dc:creator>
      <pubDate>Sat, 20 Jan 2024 06:32:53 +0000</pubDate>
      <link>https://dev.to/cebuka/regex-in-js-explained-ch7</link>
      <guid>https://dev.to/cebuka/regex-in-js-explained-ch7</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.pixabay.com%2Fphoto%2F2020%2F04%2F30%2F15%2F34%2Fcode-5113374_1280.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.pixabay.com%2Fphoto%2F2020%2F04%2F30%2F15%2F34%2Fcode-5113374_1280.jpg" alt="Regex image"&gt;&lt;/a&gt;&lt;br&gt;
Image by &lt;a href="https://pixabay.com/users/roketpik-5186989/?utm_source=link-attribution&amp;amp;utm_medium=referral&amp;amp;utm_campaign=image&amp;amp;utm_content=5113374" rel="noopener noreferrer"&gt;Artur Shamsutdinov&lt;/a&gt; from &lt;a href="https://pixabay.com//?utm_source=link-attribution&amp;amp;utm_medium=referral&amp;amp;utm_campaign=image&amp;amp;utm_content=5113374" rel="noopener noreferrer"&gt;Pixabay&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Regex in programming refers to regular expressions. Regular expressions are patterns of text that are used to search or match strings. They exist in many programming languages but our focus is on Javascript. In Javascript, they are used for manipulating and matching strings and input validation. Regular expressions use a well-defined set of characters for string manipulation.&lt;/p&gt;
&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;p&gt;What is Regex?&lt;br&gt;
Flags&lt;br&gt;
Patterns&lt;br&gt;
Regex literal&lt;br&gt;
Regex constructor&lt;br&gt;
Metacharacters&lt;br&gt;
Character classes&lt;br&gt;
Negated character classes&lt;br&gt;
Ranges&lt;br&gt;
Matching a password as an example&lt;br&gt;
Conclusion&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisite&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;Familiarity with Javascript is required to understand and apply the information in this article.&lt;/p&gt;
&lt;h3&gt;
  
  
  What is Regex?
&lt;/h3&gt;

&lt;p&gt;Regex are patterns of text that are used for searching and matching strings in Javascript. They are used in input validation, password validation, and other string manipulations.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;myString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;In here somewhere lies my name. Daniel is the name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;findMyName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/Daniel/g&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;myString&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;findMyName&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="c1"&gt;//Output: ["Daniel"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the code above, &lt;em&gt;myString&lt;/em&gt; is a line of text. &lt;em&gt;findMyName&lt;/em&gt; is a regex represented by enclosing in forward slashes. The g in the regex is called a flag.&lt;br&gt;
Several string methods can be used on regex. In the above code, the &lt;em&gt;match&lt;/em&gt; method is used.&lt;/p&gt;
&lt;h3&gt;
  
  
  Flags
&lt;/h3&gt;

&lt;p&gt;Flags are special characters placed after the ending forward slash of a regex that modifies how the pattern matching is performed. There are a total of six commonly used flags in regex. They include:&lt;br&gt;
&lt;em&gt;i&lt;/em&gt; - case-insensitivity&lt;br&gt;
&lt;em&gt;g&lt;/em&gt; - global for finding all matches not just the first&lt;br&gt;
&lt;em&gt;m&lt;/em&gt; - multiline for matching the start and end of multi-line string&lt;br&gt;
&lt;em&gt;s&lt;/em&gt; - dot-all for matching any character except newline&lt;br&gt;
&lt;em&gt;u&lt;/em&gt; - Unicode used for handling Unicode characters&lt;br&gt;
&lt;em&gt;x&lt;/em&gt; - verbose for ignoring whitespace and adding comments&lt;/p&gt;
&lt;h3&gt;
  
  
  Patterns
&lt;/h3&gt;

&lt;p&gt;They are a sequence of characters that define how a search or match is performed. There are many patterns used in regex such as literals, character sets, quantifiers, etc.&lt;br&gt;
For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;findMyName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/Daniel/g&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above code, &lt;em&gt;Daniel&lt;/em&gt; is a string literal for searching for the string specified.&lt;/p&gt;

&lt;h3&gt;
  
  
  Regex literal
&lt;/h3&gt;

&lt;p&gt;Regex literal refers to the enclosing of strings in forward slashes for pattern matching.&lt;br&gt;
The previous code image is a perfect example of a regex literal.&lt;/p&gt;
&lt;h3&gt;
  
  
  Regex constructor
&lt;/h3&gt;

&lt;p&gt;Regex constructor is the use of the Javascript RegExp constructor for creating regex patterns. The constructor takes two arguments; the string to be matched and the flag.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;findMyName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;RegExp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Daniel&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;g&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above code, the RegExp constructor takes the &lt;em&gt;Daniel&lt;/em&gt;  string as a pattern to be matched and takes the global flag for full search.&lt;/p&gt;

&lt;h3&gt;
  
  
  Metacharacters
&lt;/h3&gt;

&lt;p&gt;Metacharacters are characters that have special meanings. They include:&lt;br&gt;
&lt;em&gt;'.'&lt;/em&gt;, &lt;em&gt;'^'&lt;/em&gt;, &lt;em&gt;'+'&lt;/em&gt;, &lt;em&gt;'$'&lt;/em&gt;, &lt;em&gt;'?'&lt;/em&gt;, &lt;em&gt;'|'&lt;/em&gt;, &lt;em&gt;'()'&lt;/em&gt;, &lt;em&gt;'{}'&lt;/em&gt;, etc&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;find&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/^Me/&lt;/span&gt;
&lt;span class="c1"&gt;//Matches if the string starts with "Me"&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;find&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/Him$/&lt;/span&gt;
&lt;span class="c1"&gt;//Matches if the string ends with "Him"&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;findMeOrHim&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/Me|Him/&lt;/span&gt;
&lt;span class="c1"&gt;//Matches "Me" or "Him" in the string&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Some metacharacters are called &lt;strong&gt;quantifiers&lt;/strong&gt; because they find the number of occurrences of a character. The &lt;em&gt;'?'&lt;/em&gt;, &lt;em&gt;'+'&lt;/em&gt;, &lt;em&gt;'&lt;/em&gt;'&lt;em&gt;, *'{}'&lt;/em&gt; characters fall into this category.&lt;br&gt;
Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;findZeroOrMoreA&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/a*/&lt;/span&gt; 
&lt;span class="c1"&gt;//Matches zero or more occurrences of a&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;findOneOrMoreB&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/b+/&lt;/span&gt; 
&lt;span class="c1"&gt;//Matches one or more occurrences of b&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;find_4_To_5_digits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\d{4,5}&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt; 
&lt;span class="c1"&gt;//Matches 4 - 5 occurrences of a digit&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;findZeroOrOneA&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/a&lt;/span&gt;&lt;span class="se"&gt;?&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;
&lt;span class="c1"&gt;//Matches zero or one occurrence of a &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Character classes
&lt;/h3&gt;

&lt;p&gt;Character classes are used to match any one character from a set of characters. The characters searched for are enclosed in square brackets.&lt;br&gt;
Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;findVowel&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;[&lt;/span&gt;&lt;span class="sr"&gt;aieou&lt;/span&gt;&lt;span class="se"&gt;]&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;
&lt;span class="c1"&gt;//Match any vowel&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;findDigit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;[&lt;/span&gt;&lt;span class="sr"&gt;0-9&lt;/span&gt;&lt;span class="se"&gt;]&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;
&lt;span class="c1"&gt;//Match any digit&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;findLetter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;[&lt;/span&gt;&lt;span class="sr"&gt;A-Za-z&lt;/span&gt;&lt;span class="se"&gt;]&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;
&lt;span class="nx"&gt;Match&lt;/span&gt; &lt;span class="nx"&gt;any&lt;/span&gt; &lt;span class="nx"&gt;uppercase&lt;/span&gt; &lt;span class="nx"&gt;or&lt;/span&gt; &lt;span class="nx"&gt;lowercase&lt;/span&gt; &lt;span class="nx"&gt;letter&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Some of the classes can be represented in shorthand form. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;findDigit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\d&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;
&lt;span class="c1"&gt;//for /[0-9]/&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;findNonDigit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\D&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;
&lt;span class="c1"&gt;//for non-digits&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;findWord&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\w&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;
&lt;span class="c1"&gt;//for word character: [a-zA-z0-9_]&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;findNonWord&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\W&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;
&lt;span class="c1"&gt;//for non-word character: [^A-Za-z0-9_]&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;findWhiteSpace&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\s&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;
&lt;span class="c1"&gt;//for whitespace&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;findNonWhiteSpace&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\S&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;
&lt;span class="c1"&gt;//for non-whitespace&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The metacharacters lose their special meaning inside classes except the &lt;em&gt;-&lt;/em&gt; which is used to show range.&lt;/p&gt;

&lt;h3&gt;
  
  
  Negated Character classes
&lt;/h3&gt;

&lt;p&gt;The &lt;strong&gt;^&lt;/strong&gt; character is used for the negation of character classes. It is different from the metacharacter because it is used inside the square bracket. Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;findNonDigit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;[^&lt;/span&gt;&lt;span class="sr"&gt;0-9&lt;/span&gt;&lt;span class="se"&gt;]&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;
&lt;span class="c1"&gt;//Matches any non-digit character&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It can also be used with the shorthand character classes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;findNonDigit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;[^\d]&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;
&lt;span class="c1"&gt;//Matches any non-digit character&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Ranges
&lt;/h3&gt;

&lt;p&gt;This is the use of the &lt;strong&gt;-&lt;/strong&gt; to show the span of a character class. It is used inside the &lt;strong&gt;[ ]&lt;/strong&gt; brackets.&lt;br&gt;
For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;findVowels&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;[&lt;/span&gt;&lt;span class="sr"&gt;aieouAIEOU&lt;/span&gt;&lt;span class="se"&gt;]&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;
&lt;span class="c1"&gt;//Matches any vowel regardless of case&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ranges can be combined with quantifiers to specify the length of a class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;findFourLetters&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/^&lt;/span&gt;&lt;span class="se"&gt;[&lt;/span&gt;&lt;span class="sr"&gt;a-zA-Z&lt;/span&gt;&lt;span class="se"&gt;]{4}&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;
&lt;span class="c1"&gt;//Matches exactly the first four letters&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Matching A Password As an Example
&lt;/h3&gt;

&lt;p&gt;Let us apply what we've been able to learn so far. In this exercise we are going to create a password-matching pattern, here are the needed criteria:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It must be at least 8 characters of alphanumerics.&lt;/li&gt;
&lt;li&gt;It must contain at least one uppercase letter.&lt;/li&gt;
&lt;li&gt;Have at least one special character.&lt;/li&gt;
&lt;li&gt;It must contain at least one lowercase letter.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;checkPassword&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/^&lt;/span&gt;&lt;span class="se"&gt;(?=&lt;/span&gt;&lt;span class="sr"&gt;.*&lt;/span&gt;&lt;span class="se"&gt;[&lt;/span&gt;&lt;span class="sr"&gt;a-z&lt;/span&gt;&lt;span class="se"&gt;])(?=&lt;/span&gt;&lt;span class="sr"&gt;.*&lt;/span&gt;&lt;span class="se"&gt;\d)(?=&lt;/span&gt;&lt;span class="sr"&gt;.*&lt;/span&gt;&lt;span class="se"&gt;[&lt;/span&gt;&lt;span class="sr"&gt;A-Z&lt;/span&gt;&lt;span class="se"&gt;])(?=&lt;/span&gt;&lt;span class="sr"&gt;.*&lt;/span&gt;&lt;span class="se"&gt;[&lt;/span&gt;&lt;span class="sr"&gt;@#$%&amp;amp;?&lt;/span&gt;&lt;span class="se"&gt;])[&lt;/span&gt;&lt;span class="sr"&gt;A-Za-z&lt;/span&gt;&lt;span class="se"&gt;\d&lt;/span&gt;&lt;span class="sr"&gt;@#$%&amp;amp;?&lt;/span&gt;&lt;span class="se"&gt;]{8,}&lt;/span&gt;&lt;span class="sr"&gt;$/g&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;password&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;gaGndhhh$6&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;password&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;checkPassword&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="c1"&gt;//Returns [ 'gaGndhhh$6', index: 0, input: 'gaGndhhh$6', groups: undefined ] if matched or null if not matched&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above code uses the &lt;em&gt;password&lt;/em&gt; string to match the regex. If null is not returned the match was successful. This is just one of the applications of in JS; it can be used to check phone numbers, emails, advanced string manipulations, etc.&lt;/p&gt;

&lt;p&gt;💡 Tip: To understand the above code, here is more on Lookaheads&lt;/p&gt;

&lt;h4&gt;
  
  
  Conclusion
&lt;/h4&gt;

&lt;p&gt;This article explains the basics of regex in JS. I believe with the information provided so far, you can take up a more advanced study of regex. I recommend checking out &lt;a href="//https:\regexr.com"&gt;RegExr&lt;/a&gt; for an interactive study of regex.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>regex</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
