<?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: Lakshya Singh</title>
    <description>The latest articles on DEV Community by Lakshya Singh (@king11).</description>
    <link>https://dev.to/king11</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%2F359741%2F7aa657f7-7559-4f22-bdd6-e147f9cab5af.jpeg</url>
      <title>DEV Community: Lakshya Singh</title>
      <link>https://dev.to/king11</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/king11"/>
    <language>en</language>
    <item>
      <title>My Journey: Google Summer of Code</title>
      <dc:creator>Lakshya Singh</dc:creator>
      <pubDate>Mon, 05 Jul 2021 13:54:22 +0000</pubDate>
      <link>https://dev.to/king11/my-journey-getting-selected-in-google-summer-of-code-2c0f</link>
      <guid>https://dev.to/king11/my-journey-getting-selected-in-google-summer-of-code-2c0f</guid>
      <description>&lt;h2&gt;
  
  
  What is GSoC?
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Google Summer of Code is a global program focused on bringing more student developers into open source software development. Students work with an open-source organization on a 10-week programming project during their break from school. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This post highlights &lt;strong&gt;my journey&lt;/strong&gt; of getting selected into the program from the very beginning. I believe that there is no defined path for getting selected in such open-source fellowships. Everyone has a unique journey, and you can take a few things from other journeys to write yours :) because the essence of each one is similar.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fixtpkgeemezmkjptjakj.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fixtpkgeemezmkjptjakj.gif" alt="Let's get started" width="560" height="282"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that I have your attention, let's get started. I will talk about my journey in two parts: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the initial &lt;strong&gt;Pre-GSoC&lt;/strong&gt; part will cover how I came about making my first contribution in Open Source and developed my skills&lt;/li&gt;
&lt;li&gt;the later part &lt;strong&gt;GSoC InFocus&lt;/strong&gt; focuses on GSoC specific things like selecting an organization, contributing, writing a proposal, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Pre-GSoC
&lt;/h2&gt;

&lt;p&gt;This was a phase where I wasn't much worried about GSoC and focused on developing my skills, adding new tech stacks into my belt, developing more projects, and contributing to open source.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This phase is crucial because your zeal and fire to contribute and make a mark in the open-source community starts to rage, and doing some fuels that fire further.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  How I came to know about GSoC?
&lt;/h3&gt;

&lt;p&gt;The first time I heard about GSoC was in an event conducted by &lt;a href="http://copsiitbhu.co.in/" rel="noopener noreferrer"&gt;Club of Programmers IITBHU&lt;/a&gt; where I was introduced to open-source programs like GSoC, Outreachy, etc. and people who were previously selected shared their experience with us. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnbvz8qj2juy4gjwuhah5.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnbvz8qj2juy4gjwuhah5.gif" alt="conference" width="480" height="302"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I wasn't sure whether I would someday dwell into the realm of Open Source as, at that time, I was more focused on Competitive Programming like most of my peers. But things changed after the programming Camp in the Winter of 2019, where I started with Web Dev, and now I was sure I want to be amongst the group of people who clear GSoC.&lt;/p&gt;

&lt;p&gt;Then came the GSoC'20. Many of my seniors who applied got selected, and I thought that a first-year student could never clear GSoC ( that perception changed this year :) ), so I focused on improving my skills in Web Development and didn't bother applying in 2020.&lt;/p&gt;

&lt;h3&gt;
  
  
  Learning Phase
&lt;/h3&gt;

&lt;p&gt;I was &lt;em&gt;burning the midnight oil&lt;/em&gt; to make web development my forte be it backend or frontend, vue or react, Django or NodeJS... I wanted to know it all as there existed so many fascinating things for me to learn.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj2mh9hlzcy3csitn5zpi.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj2mh9hlzcy3csitn5zpi.gif" alt="learning new things" width="480" height="208"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So here are some of the things I did to strengthen my skills in web development :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I utilized &lt;a href="http://frontendmasters.com/" rel="noopener noreferrer"&gt;Frontend Masters&lt;/a&gt; to cover most front-end things like frameworks and Design. Also took a git course by &lt;a href="https://twitter.com/nnja" rel="noopener noreferrer"&gt;@nnja&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;For Django, I started dwelling into the docs of &lt;a href="https://docs.djangoproject.com/en/3.2/" rel="noopener noreferrer"&gt;Django&lt;/a&gt; and &lt;a href="https://www.django-rest-framework.org/" rel="noopener noreferrer"&gt;DRF&lt;/a&gt; to learn more advanced features after completing basic stuff from &lt;a href="https://djangogirls.org/" rel="noopener noreferrer"&gt;DjangoGirls&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Then, I did some projects using what I have learned to combine both backend and frontend. I did invest quite some time in them, and it was fun.&lt;/li&gt;
&lt;li&gt;Later on, when I came to know about things like NodeJS being faster and a more scalable DB such as MongoDB, I did a project using them in a &lt;a href="https://devfolio.co/submissions/peer-io-7356" rel="noopener noreferrer"&gt;Hackathon&lt;/a&gt; with my friends &lt;a href="https://github.com/m-e-l-u-h-a-n" rel="noopener noreferrer"&gt;@Purushottam&lt;/a&gt; and &lt;a href="https://github.com/dasari810" rel="noopener noreferrer"&gt;@Madhava&lt;/a&gt;, which we won too 🥳&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Apart from my own projects, I participated in projects of our Programming Club and also did an intern in a freelance project. These things prepared me to swiftly walk through a large codebase, collaborate on Github, use version control, apply my knowledge, etc.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Open Source Hacktoberfest
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;There couldn't be a better start for your open-source journey than &lt;a href="https://hacktoberfest.digitalocean.com/" rel="noopener noreferrer"&gt;HacktoberFest&lt;/a&gt;. It's an annual open-source event where project maintainers await your contributions, and they prepare their projects to accept new contributors.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Apart from contributing, you also get rewarded swags, tees, etc., by DigitalOcean and some of the projects. You can check out &lt;a href="https://hacktoberfestswaglist.com/" rel="noopener noreferrer"&gt;hacktoberfestswaglist&lt;/a&gt; during hacktoberfest to know about projects offering additional swags.&lt;/p&gt;

&lt;p&gt;I outlined my hacktoberfest with my friend &lt;a href="https://github.com/K-Kumar-01" rel="noopener noreferrer"&gt;Kushal&lt;/a&gt; ahead of October. We decided to go good-first hunting, work on several issues and earn some swags. Who doesn't like swags, right? So I intended on completing the tasks to get those swags.&lt;/p&gt;

&lt;p&gt;All of the projects were very welcoming. Even though I had &lt;strong&gt;no idea&lt;/strong&gt; about the tech stack they were using, I contributed to them, but I focused on solving issues and asked many questions. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3n99h0t9bkswa5vfimol.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3n99h0t9bkswa5vfimol.gif" alt="helping out" width="498" height="278"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Some of my contributions which you can check out :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/DXHeroes/dx-scanner/issues?q=is%3Aclosed+author%3Aking-11" rel="noopener noreferrer"&gt;DX Heroes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/OperationCode/resources_api/pulls?q=is%3Apr+author%3Aking-11+is%3Aclosed" rel="noopener noreferrer"&gt;Operation Code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/datenanfragen/website/issues?q=author%3Aking-11+is%3Aclosed" rel="noopener noreferrer"&gt;Datenanfragen&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/jayehernandez/letra-extension/issues?q=author%3Aking-11+is%3Aclosed" rel="noopener noreferrer"&gt;Letra&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;By the end of October, I was familiar with contributing to open source projects, interacting with communities, finding issues, making PRs, and working my way around good first issues.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  GSoC InFocus
&lt;/h2&gt;

&lt;p&gt;For most people, this phase is after and around December and January, where you start looking at organizations finding relevant and interesting projects to contribute to.&lt;/p&gt;

&lt;h3&gt;
  
  
  Selecting Organizations
&lt;/h3&gt;

&lt;p&gt;I started looking at GSoC archives in January and probably would have gone through the whole A-Z list about 10-20 times. Earlier, they didn't have filters for the tech stack, but they have it now, and it really helps to select the organization.&lt;/p&gt;

&lt;p&gt;First, I jotted down the list of organizations I want to contribute to based primarily on my interest in their past and current projects and those that didn't require me to learn something completely new ( biggest mistake '-' ).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fexv3obo3jyozma4nmx8x.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fexv3obo3jyozma4nmx8x.jpg" alt="filtered org list.jpg" width="800" height="584"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One of the most useful tools I found when selecting my GSoC organization was developed by one of my seniors &lt;a class="mentioned-user" href="https://dev.to/nishantwrp"&gt;@nishantwrp&lt;/a&gt;  . With all the statistics at hand, I can filter out organizations.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/nishantwrp" rel="noopener noreferrer"&gt;
        nishantwrp
      &lt;/a&gt; / &lt;a href="https://github.com/nishantwrp/gsoc-organizations" rel="noopener noreferrer"&gt;
        gsoc-organizations
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A site for viewing and analyzing the info of the organizations participating in Google Summer of Code.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;p&gt;
  &lt;a href="https://www.gsocorganizations.dev" rel="nofollow noopener noreferrer"&gt;
    &lt;img alt="GSoC Organizations" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fnishantwrp%2Fgsoc-organizations%2F.%2Fstatic%2Fimages%2Flogo.png" width="60"&gt;
  &lt;/a&gt;
&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;
  GSoC Organizations
  &lt;br&gt;
  &lt;a rel="noopener noreferrer" href="https://github.com/nishantwrp/gsoc-organizations/workflows/Lint%20checks/badge.svg"&gt;&lt;img src="https://github.com/nishantwrp/gsoc-organizations/workflows/Lint%20checks/badge.svg"&gt;&lt;/a&gt;
  &lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/deba280247a6b363ee39f0ef85d2f77c09f111433794701675abc02365082a84/68747470733a2f2f6d616465776974686c6f76652e6e6f772e73682f696e"&gt;&lt;img src="https://camo.githubusercontent.com/deba280247a6b363ee39f0ef85d2f77c09f111433794701675abc02365082a84/68747470733a2f2f6d616465776974686c6f76652e6e6f772e73682f696e" alt="Made with love in India"&gt;&lt;/a&gt;
  &lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/11c502cb0edd6eac274e462c7a70981ee26fde99043dba967b732d371efa2b87/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5052732d77656c636f6d652d627269676874677265656e2e7376673f7374796c653d666c6174"&gt;&lt;img src="https://camo.githubusercontent.com/11c502cb0edd6eac274e462c7a70981ee26fde99043dba967b732d371efa2b87/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5052732d77656c636f6d652d627269676874677265656e2e7376673f7374796c653d666c6174"&gt;&lt;/a&gt;
  &lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/52104b7dae651b4dfe5ed92c574fc7740b1ffc7b5a5acb4cc4a68bfd943a3076/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6e697368616e747772702f67736f632d6f7267616e697a6174696f6e73"&gt;&lt;img src="https://camo.githubusercontent.com/52104b7dae651b4dfe5ed92c574fc7740b1ffc7b5a5acb4cc4a68bfd943a3076/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6e697368616e747772702f67736f632d6f7267616e697a6174696f6e73"&gt;&lt;/a&gt;
  &lt;a title="MadeWithReactJs.com Shield" href="https://madewithreactjs.com/p/gsoc-organizations/shield-link" rel="nofollow noopener noreferrer"&gt; &lt;img src="https://camo.githubusercontent.com/07bfc072c6ed3f0a9f08f8abbd7e89889413c1657dd69598f08ed114273ea9d5/68747470733a2f2f6d6164657769746872656163746a732e636f6d2f73746f726167652f7265706f2d736869656c64732f323835382d736869656c642e737667"&gt;&lt;/a&gt;
&lt;/h1&gt;
&lt;/div&gt;

&lt;p&gt;A site for viewing and analysing the info of the organizations participating in &lt;a href="https://summerofcode.withgoogle.com/" rel="nofollow noopener noreferrer"&gt;Google Summer of Code&lt;/a&gt; and filtering them by various factors like years of participation, categories, etc.&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Tech Stack&lt;/h2&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.gatsbyjs.com/" rel="nofollow noopener noreferrer"&gt;Gatsby&lt;/a&gt; - Gatsby is the frontend framework used for developing this site.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://redocly.github.io/redoc/" rel="nofollow noopener noreferrer"&gt;Redoc&lt;/a&gt; - Redoc is used for generating api docs.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;💫 Deployment Status&lt;/h2&gt;

&lt;/div&gt;

&lt;div class="markdown-heading"&gt;
&lt;h4 class="heading-element"&gt;Main Site&lt;/h4&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://app.netlify.com/sites/gsoc-organizations/deploys" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/713ef4a4340191b4d021b8e967be0c14a6053a197d455ea6b664d4de0afee573/68747470733a2f2f6170692e6e65746c6966792e636f6d2f6170692f76312f6261646765732f37316364613130342d393230652d343866362d616133352d3563376336333635353236312f6465706c6f792d737461747573"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h4 class="heading-element"&gt;API docs&lt;/h4&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://app.netlify.com/sites/gsoc-organizations-api/deploys" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/5bf43e53a1f13050fc1cd84d2bace8638935a6a7f47d89da902759ab430cbeb2/68747470733a2f2f6170692e6e65746c6966792e636f6d2f6170692f76312f6261646765732f31353036346237632d663165392d343363642d386337652d6133373039323134643231652f6465706c6f792d737461747573"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;🚀 Contributing&lt;/h2&gt;

&lt;/div&gt;

&lt;p&gt;Contributions are most welcome in this project be it reporting an issue or sending a pull request.&lt;/p&gt;

&lt;p&gt;Some of the things you could help with currently are -&lt;/p&gt;


&lt;ol&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Improving custom filters&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The data displayed is scraped from the official &lt;a href="https://summerofcode.withgoogle.com/archive" rel="nofollow noopener noreferrer"&gt;GSoC Archive&lt;/a&gt;. There may be some errors in the data. To tackle that custom filters are applied on the data which are defined in &lt;a href="https://github.com/nishantwrp/gsoc-organizations/tree/master/api/filters" rel="noopener noreferrer"&gt;api/filters&lt;/a&gt;. The filters can be improved a lot.&lt;/p&gt;

&lt;p&gt;Example 1 - There may be duplicate organizations on the site which is due…&lt;/p&gt;


&lt;/li&gt;

&lt;/ol&gt;
&lt;/div&gt;
&lt;br&gt;
  &lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/nishantwrp/gsoc-organizations" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;p&gt;The list, as you can see, consisted of around 30-40 organizations. So I started filtering them out based on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Number of times org was selected for GSoC in past&lt;/li&gt;
&lt;li&gt;The tech stack they were working on should align with what I know, things like Javascript, Python, NodeJS, Rest APIs, etc.&lt;/li&gt;
&lt;li&gt;Number of students they select, which I filtered to be at least greater than or equal to 4.&lt;/li&gt;
&lt;li&gt;Amount of people already contributing to them because eventually only a few students will be selected for summer.&lt;/li&gt;
&lt;li&gt;Organizations using IRC as a means of communication were a &lt;em&gt;big NO!&lt;/em&gt; for me.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the end, I decided to go with &lt;a href="https://github.com/HTTP-APIs" rel="noopener noreferrer"&gt;HTTP-APIs&lt;/a&gt;. I started checking out their Contributing Guidelines, Resources to get started, and their repositories. I selected HTTP-APIs because REST APIs are my forte, and they were doing something pretty interesting.&lt;/p&gt;

&lt;p&gt;I made a few contributions to their repos, upgraded their dependencies to support python v3.8 and updated Dockerfile. &lt;/p&gt;

&lt;p&gt;Still, a few things that took me away from them were that the mentors weren't that responsive, and even though I went through all of their resources, I couldn't find something significant to contribute.&lt;/p&gt;

&lt;p&gt;So I drifted away from HTTP-APIs, but at the back of my mind, it was still that I have to make it work there somehow.&lt;/p&gt;

&lt;h3&gt;
  
  
  Change of Plans
&lt;/h3&gt;

&lt;p&gt;If you know me prior, you already know that I never went through with HTTP-APIs instead, it was &lt;a href="https://chapel-lang.org/" rel="noopener noreferrer"&gt;Chapel&lt;/a&gt;. Chapel is a programming language designed for productive parallel computing at scale.&lt;/p&gt;

&lt;p&gt;The story behind the finding of Chapel is something that you don't hear often. I was in a meeting with my peers, and we started talking about things we are doing, and GSoC became a part of the discussion. &lt;/p&gt;

&lt;p&gt;My friend &lt;a href="https://codeforces.com/profile/rivalq" rel="noopener noreferrer"&gt;@Jatin&lt;/a&gt; stated to me that, and I quote, "there is this language where you can run statements simultaneously using a &lt;code&gt;forall&lt;/code&gt; loop". He seemed pretty interested, and so sparked the idea of taking a look at Chapel.&lt;/p&gt;

&lt;p&gt;It was also at the same time, i.e. February, I was talking with one of my seniors &lt;a href="https://www.linkedin.com/in/ashishkr23438/" rel="noopener noreferrer"&gt;@Ashish&lt;/a&gt;, who previously got selected in GSoC under &lt;a href="https://github.com/pgRouting" rel="noopener noreferrer"&gt;OSGeo&lt;/a&gt;. My primary concern was that HTTP-APIs didn't work, and if I go in places related to Web Development there, the amount of already active students is way more than I wish to compete with.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpi9l6mz0hct4k0qadvpw.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpi9l6mz0hct4k0qadvpw.gif" alt="change of plans" width="480" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So the plan I made after discussing with Ashish was to contribute to something, not JS, not Python, but things constituting C++, C, or some new language. And since Chapel caught my interest, I started there.&lt;/p&gt;

&lt;p&gt;It is hard to find a project where you have experience with all the technical tools, so in hindsight, it’s okay for you to select an organization where you have only 40% of the tech stack down. You might even end up working with the part of the software that uses a language you have zero familiarity with, like me.&lt;/p&gt;

&lt;h3&gt;
  
  
  Contributing to the project
&lt;/h3&gt;

&lt;p&gt;The thing with all GSoC organizations is that they have excellent resources for you to get started with. This includes documentation, contributing guidelines, getting started with contributions, etc.&lt;/p&gt;

&lt;p&gt;Just as HTTP-APIs, Chapel also had excellent resources for me to learn it, and I went straight for them started writing small scripts, learning the syntax incrementally.&lt;/p&gt;

&lt;p&gt;The question you might have for me is why I decided to stick around with Chapel? The difference was chapel has so many issues &lt;em&gt;( over 2k )&lt;/em&gt;, and these are the ones made by the core team itself. That made it pretty clear that I can contribute a lot and the team is highly active in developing the project.&lt;/p&gt;

&lt;p&gt;I was observant even when reading the documentation and talked in the &lt;a href="https://gitter.im/chapel-lang/chapel" rel="noopener noreferrer"&gt;gitter&lt;/a&gt; channel about how the documentation can be improved. I was also helping out by answering some of the questions in the channel.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjd62h7e19jla50qdnsa4.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjd62h7e19jla50qdnsa4.gif" alt="coding is fun" width="700" height="391"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Something that usually people forget about is interacting a being a part of the community. It's not just about coding your way around, and I made sure that I opened gitter every day to take a look at the ongoing discussion here as well as on Github Issues.&lt;/p&gt;

&lt;p&gt;As chapel is a comparatively new language, I knew there could be scope for improvement on the implementation done in Modules. Also, at the time when I started contributing, I was pursuing courses on Algorithms and Operating System as part of my college curriculum.&lt;/p&gt;

&lt;p&gt;So I went on to find the implementation of Quick Sort and Heap in the codebase, discussed few updates on them, and made a Pull Request.&lt;/p&gt;

&lt;p&gt;After that, I started looking at existing issues, discussing how I should work them out, the idea of the core team about the issue, and eventually made the Pull Request for it to be reviewed.&lt;/p&gt;

&lt;p&gt;The thing that kept me engaged in chapel was the quick response from mentors within a day or two. That made me feel that my contributions are very much appreciated.&lt;/p&gt;

&lt;h3&gt;
  
  
  Writing Proposal
&lt;/h3&gt;

&lt;p&gt;It is expected for a proposal to contain a detailed explanation of your implementation and timeline. What gives you an edge is your contributions to the project until then. This helps solidify the trust in your abilities to finish the project.&lt;/p&gt;

&lt;p&gt;Even though I had drifted away from Web Dev, it all came back when projects that were announced by Chapel had a project on &lt;strong&gt;Socket Library&lt;/strong&gt;. This was something that I was targeting since it was announced even before organizations were announced.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Even though Chapel gave me a place to contribute to it was the project that kept me going because it's my niche and was something where I can apply all the knowledge I gathered over time.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I started working on my proposal after getting clarity on few things from my mentor on what were they expecting from the project. I also used to look out for questions that other people were asking related to my project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffpopduu9eo6ts0elyeyc.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffpopduu9eo6ts0elyeyc.gif" alt="writing" width="500" height="280"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I got up to speed on working with sockets in &lt;code&gt;C&lt;/code&gt;, went through the design of the socket library in &lt;code&gt;Python&lt;/code&gt;, gathered more information about non-blocking sockets, and finally designed my proposal.&lt;/p&gt;

&lt;p&gt;I made sure to add in code snippets and mock implementation of how the code will be implemented in &lt;code&gt;C&lt;/code&gt; and &lt;code&gt;Chapel&lt;/code&gt;. It is also a good idea to add in diagrams which I did, because images speak more than text.&lt;/p&gt;

&lt;p&gt;My organization mentors seemed happy with the design because they didn't seem to have much issue with what I had shown them in the draft. &lt;/p&gt;

&lt;p&gt;But &lt;a href="https://shivanshs9.me/" rel="noopener noreferrer"&gt;@Shivansh&lt;/a&gt;, one of my seniors I requested to review my proposal, told me that it was less technical and needed more of it. This pushed me to improve my proposal further, add more details about the implementation, add in diagrams and code snippets.&lt;/p&gt;

&lt;p&gt;You can find mine and several other accepted proposals in this repository. Courtesy of &lt;a href="http://copsiitbhu.co.in/" rel="noopener noreferrer"&gt;Club of Programmers IIT BHU&lt;/a&gt;&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/COPS-IITBHU" rel="noopener noreferrer"&gt;
        COPS-IITBHU
      &lt;/a&gt; / &lt;a href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals" rel="noopener noreferrer"&gt;
        GSoC-Accepted-Proposals
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      This repository serves as an archive of GSoC - Google Summer of Code accepted proposals of IIT (BHU), Varanasi students.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;GSoC Accepted Proposals: 2019-2024&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;This repository serves as an archive of &lt;a href="https://summerofcode.withgoogle.com/" rel="nofollow noopener noreferrer"&gt;GSoC - Google Summer of Code&lt;/a&gt; accepted proposals of IIT (BHU), Varanasi students. GSoC is an &lt;em&gt;F&lt;/em&gt;ree and &lt;em&gt;O&lt;/em&gt;pen &lt;em&gt;S&lt;/em&gt;ource programme and COPS IIT (BHU) highly encourages the students to contribute to Open Source.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;&lt;a href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals/2019" rel="noopener noreferrer"&gt;2019&lt;/a&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals/2019/VideoLAN%20-%202019%20-%20Shivansh%20Saini.pdf" rel="noopener noreferrer"&gt;Shivansh Saini - VideoLAN&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;&lt;a href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals/2020" rel="noopener noreferrer"&gt;2020&lt;/a&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals/2020/CERN-HSF%20-%202020%20-%20Shivansh%20Saini.pdf" rel="noopener noreferrer"&gt;Shivansh Saini - CERN-HSF&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals/2020/Julia%20-%202020%20-%20Akshay%20Sharma.pdf" rel="noopener noreferrer"&gt;Akshay Sharma - Julia&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals/2020/MLPack%20-%202020%20-%20Nishant%20Kumar.pdf" rel="noopener noreferrer"&gt;Nishant Kumar - MLPack&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals/2020/Oppia%20-%202020%20-%20Nishant%20Mittal.pdf" rel="noopener noreferrer"&gt;Nishant Mittal - Oppia&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals/2020/pgRouting%20-%202020%20-%20Ashish%20Kumar.pdf" rel="noopener noreferrer"&gt;Ashish Kumar - pgRouting&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals/2020/Sympy%20-%20%202020%20-%20Smit%20Lunagariya.pdf" rel="noopener noreferrer"&gt;Smit Lunagariya - Sympy&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;&lt;a href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals/2021" rel="noopener noreferrer"&gt;2021&lt;/a&gt;&lt;/h3&gt;

&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals/2021/Accord%20Project%20-%202021%20-%20Kushal%20Kumar.pdf" rel="noopener noreferrer"&gt;Kushal Kumar - Accord Project&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals/2021/Aossie%20-%202021%20-%20Suryansh%20Singh%20Tomar.pdf" rel="noopener noreferrer"&gt;Suryansh Singh Tomar - Aossie&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals/2021/Apache%20-%202021%20-%20Bikram%20Biswas.pdf" rel="noopener noreferrer"&gt;Bikram Biswas - Apache&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals/2021/CCExtractor%20-%202021%20-%20Nishtha%20Bodani.pdf" rel="noopener noreferrer"&gt;Nishtha Bodani - CCExtractor&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals/2021/CHAOSS%20-%202021%20-%20Yash%20Prakash.pdf" rel="noopener noreferrer"&gt;Yash Prakash - CHAOSS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals/2021/Chapel%20Lang%20-%202021%20-%20Lakshya%20Singh.pdf" rel="noopener noreferrer"&gt;Lakshya Singh - Chapel&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals/2021/CNCF%20-%202021%20-%20Arsh%20Sharma.pdf" rel="noopener noreferrer"&gt;Arsh Sharma - CNCF&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals/2021/Coala%20-%202021%20-%20Sanchit%20Gupta.pdf" rel="noopener noreferrer"&gt;Sanchit Gupta - Coala&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals/2021/Continuous%20Delivery%20foundation%20-%202021%20-%20Pulkit%20Sharma.pdf" rel="noopener noreferrer"&gt;Pulkit Sharma - Continuous Delivery Foundation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals/2021/freifunk%20-%202021%20-%20Avinash%20Kumar.pdf" rel="noopener noreferrer"&gt;Avinash Kumar - freifunk&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals/2021/Intel%20Video%20and%20Audio%20for%20Linux%20-%202021%20-%20Shubhanshu%20Saxena.pdf" rel="noopener noreferrer"&gt;Shubhanshu Saxena - Intel Video and Audio for Linux&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals/2021/Joplin%20-%202021%20-%20Nishant%20Mittal.pdf" rel="noopener noreferrer"&gt;Nishant Mittal - Joplin&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals/2021/NRNB%20-%202021%20-%20Pankaj%20Yadav.pdf" rel="noopener noreferrer"&gt;Pankaj Yadav - NRNB&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals/2021/Oppia%20-%202021%20-%20Aishwary%20Saxena.pdf" rel="noopener noreferrer"&gt;Aishwary Saxena - Oppia&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals/2021/Oppia%20-%202021%20-%20Arjun%20Gupta.pdf" rel="noopener noreferrer"&gt;Arjun Gupta - Oppia&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals/2021/Oppia%20-%202021%20-%20Aryaman%20Gupta.pdf" rel="noopener noreferrer"&gt;Aryaman Gupta&lt;/a&gt;…&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/COPS-IITBHU/GSoC-Accepted-Proposals" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  Post Proposal Submission
&lt;/h3&gt;

&lt;p&gt;Going inactive after proposal submission shows that you aren't interested in the community, and you were doing it just for namesake.&lt;/p&gt;

&lt;p&gt;I ensured that after proposal submission, I kept contributing and was active not that much but still had my presence in the channel. I wrote in my proposal that I would get all my pending PRs merged, and that's what I did.&lt;/p&gt;

&lt;p&gt;Fast forward to 17th May, I was in a voice call when the result came out, and I literally shouted woohoo!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyubtuc6y0ibdg3nbxyqr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyubtuc6y0ibdg3nbxyqr.png" alt="gsoc result mail" width="800" height="325"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Final thoughts
&lt;/h2&gt;

&lt;p&gt;GSoC is a non-competitive (after getting selected, of course 😏) program so try to cherish the community alongside it. Find your motivation; why do you even want to do it first, and the rest will follow.&lt;/p&gt;

&lt;p&gt;GSoC is not an internship and should not be looked at as a way to earn money. It is definitely not something you should pursue half-heartedly or just for the sake of it, nor it would help you neither the community, and there can be better ways for you than open-source.&lt;/p&gt;

&lt;p&gt;I am learning a lot from my mentors and fellow GSoC mentees. The community is something I will definitely enjoy and use my summer to learn from them and, as I say, make &lt;strong&gt;Chapel go to Web&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxcew6ohgrso5gn0huhkh.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxcew6ohgrso5gn0huhkh.gif" alt="that's all folks" width="560" height="410"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading :) and please share your thoughts. I always like to meet more enthusiastic people, so do reach out to me on &lt;a href="https://twitter.com/1108King" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; or &lt;a href="https://www.linkedin.com/in/lakshyasingh11/" rel="noopener noreferrer"&gt;Linkedin&lt;/a&gt; to share your feedback or for any queries. I'd be more than happy to help and connect.&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>gsoc</category>
    </item>
    <item>
      <title>Dynamic Classes and Styles</title>
      <dc:creator>Lakshya Singh</dc:creator>
      <pubDate>Wed, 23 Jun 2021 08:31:45 +0000</pubDate>
      <link>https://dev.to/king11/dynamic-classes-and-styles-3lff</link>
      <guid>https://dev.to/king11/dynamic-classes-and-styles-3lff</guid>
      <description>&lt;p&gt;In this article, I aim to provide a not so new but also not so known way of adding &lt;strong&gt;dynamic features&lt;/strong&gt; into your application, ensuring that you can achieve what you wish to simply &lt;strong&gt;without&lt;/strong&gt; writing &lt;em&gt;boilerplate code&lt;/em&gt; and meddling with &lt;em&gt;string concatenation&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;When writing Dynamic UI Components that respond to user actions and events, we require methods to respond to these events by translating them into our DOM. Change in DOM is usually achieved by changing &lt;em&gt;styles&lt;/em&gt; and &lt;em&gt;classes&lt;/em&gt; based on certain &lt;strong&gt;reactive data&lt;/strong&gt; that we have in our javascript. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyydg0rqygblvb6ptde80.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyydg0rqygblvb6ptde80.png" alt="old methods work but we can do better" width="800" height="684"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;While we can certainly do string concatenation, calculate a string and then bind a string to class or style... this method is error-prone and cumbersome at times to deal with. That's where Vue.js's clean suite of enhancements come into vue &lt;em&gt;( french for 'view' )&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Quick Recap Data Binding
&lt;/h2&gt;

&lt;p&gt;If you aren't familiar with what data binding is....it's essentially binding any attribute of an element in your &lt;code&gt;template&lt;/code&gt; to the data available in your &lt;code&gt;script&lt;/code&gt; tag, which can be props,  data or computed properties.&lt;/p&gt;

&lt;p&gt;Data binding is one of the most elegant features of Vue.js because it provides reactive data binding with a straightforward syntax using &lt;code&gt;v-bind&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; 
  &lt;span class="na"&gt;v-bind:class=&lt;/span&gt;&lt;span class="s"&gt;"dynamicClass"&lt;/span&gt;
&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Hello World!
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A shorthand for data binding is but just using &lt;code&gt;:&lt;/code&gt; and then the attribute name, which I guess anyone would prefer using more.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; 
  &lt;span class="na"&gt;:class=&lt;/span&gt;&lt;span class="s"&gt;"dynamicClass"&lt;/span&gt;
&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Hello World!
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's suppose that the above class is not &lt;em&gt;a once initialized and stays the same&lt;/em&gt; kind of class it changes based on user input, so we have to use a &lt;code&gt;computed&lt;/code&gt; property or &lt;code&gt;watch&lt;/code&gt; to make changes to our &lt;code&gt;dynamicClass&lt;/code&gt; variable. So things will start to look like this.&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="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;data&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;changingBoolean&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;computed&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;dynamicClass&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="na"&gt;changingBoolean&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;text-center text-lg&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="s1"&gt;text-justify text-xl&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Looking at the code above we can see that for a simple switch in classes based on a variable we had to write so much code. So simply creating a dynamic class won't work.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuhrk2i5plh0gmifib1bi.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuhrk2i5plh0gmifib1bi.gif" alt="we don't do simple data binding" width="498" height="280"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Array Syntax for Classes
&lt;/h2&gt;

&lt;p&gt;Enter array syntax which makes the previous task less cumbersome and also keeps it DRY at times when needed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;article&lt;/span&gt; 
  &lt;span class="na"&gt;:class=&lt;/span&gt;&lt;span class="s"&gt;"[changingBoolean : ? 'text-center' : 'text-justify']"&lt;/span&gt;
&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    Hello World!
&lt;span class="nt"&gt;&amp;lt;/aside&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This looks so much cleaner than the previous method right ≧◠‿◠≦✌. But it's an array so we can add multiple values into it too :). Now we can toggle the text alignment class while flex and width will always be present.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;article&lt;/span&gt; 
  &lt;span class="na"&gt;:class=&lt;/span&gt;&lt;span class="s"&gt;"[changingBoolean : ? 'text-center' : 'text-justify', 'flex w-2']"&lt;/span&gt;
&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    Hello World!
&lt;span class="nt"&gt;&amp;lt;/aside&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Object Syntax for Classes
&lt;/h2&gt;

&lt;p&gt;Sometimes we just want to add toggle a single class on/off when a boolean is &lt;code&gt;true&lt;/code&gt; and nothing when it's &lt;code&gt;false&lt;/code&gt;. Using ternary operator it will look as below&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="p"&gt;:&lt;/span&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="err"&gt;= [&lt;/span&gt;&lt;span class="nc"&gt;changingBoolean&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;text-center&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="s1"&gt; &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="s1"&gt;flex w-2&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;We can do better, enter &lt;strong&gt;object syntax&lt;/strong&gt; because eventually, everything is an object in javascript so why not.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frnlx134ax015u8odxkl5.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frnlx134ax015u8odxkl5.gif" alt="I object as in javascript everything is an object" width="500" height="281"&gt;&lt;/a&gt;&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="p"&gt;:&lt;/span&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="err"&gt;= [ { '&lt;/span&gt;&lt;span class="nc"&gt;text&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;center&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt; : changingBoolean }, &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="nx"&gt;flex&lt;/span&gt; &lt;span class="nx"&gt;w&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;]
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also bind an object directly to &lt;em&gt;class&lt;/em&gt; instead of keeping it inside an array and it also supports multiple togglable classes just like an array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;article&lt;/span&gt;
  &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"absolute"&lt;/span&gt;
  &lt;span class="na"&gt;:class=&lt;/span&gt;&lt;span class="s"&gt;"{ active: isActive, 'text-xl': largeText }"&lt;/span&gt;
&lt;span class="nt"&gt;&amp;gt;&amp;lt;/article&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;active&lt;/code&gt; is a simple string variable for class whereas &lt;code&gt;isActive&lt;/code&gt; and &lt;code&gt;largeText&lt;/code&gt; are boolean variables. Also if you noticed &lt;em&gt;class&lt;/em&gt; and &lt;em&gt;&lt;code&gt;:class&lt;/code&gt;&lt;/em&gt; can simultaneously exist on a single element ツ&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Passing in Objects
&lt;/h3&gt;

&lt;p&gt;We can also pass in reactive &lt;code&gt;array/object&lt;/code&gt; stored in our &lt;code&gt;data&lt;/code&gt; or &lt;code&gt;computed&lt;/code&gt; to classes. This can be a more powerful pattern at times when you have to do multiple checks and toggling which when accommodated into HTML won't look good and readable.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;nav&lt;/span&gt; &lt;span class="na"&gt;:class=&lt;/span&gt;&lt;span class="s"&gt;"classObject"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/nav&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Modifying Child Classes
&lt;/h2&gt;

&lt;p&gt;Suppose we have a nice and shiny icon element we have specified several classes to it which works for most cases so we didn't bother making it a prop. But a time came when we had to change its colour in that case we want to pass down a new class to our child.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;my-icon&lt;/span&gt;
  &lt;span class="na"&gt;:class=&lt;/span&gt;&lt;span class="s"&gt;"text-blue-600"&lt;/span&gt;
&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the &lt;code&gt;:class&lt;/code&gt; will be appended at the end of the class inside of our component's parent. We can obviously also provide in a simple &lt;em&gt;&lt;code&gt;class&lt;/code&gt;&lt;/em&gt; too.&lt;/p&gt;

&lt;h2&gt;
  
  
  Array and Object Syntax for Styles
&lt;/h2&gt;

&lt;p&gt;The array and object syntax for classes and style looks exactly identical except for a very minor change. It's not about the truthiness of variables anymore it's about assigning them to the right CSS property.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;nav&lt;/span&gt; 
&lt;span class="na"&gt;:style=&lt;/span&gt;&lt;span class="s"&gt;"{ marginTop: marginTop + 'px', backgroundColor: infoColor }"&lt;/span&gt;
&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Doge Coin
&lt;span class="nt"&gt;&amp;lt;/nav&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above example, we are assigning the &lt;code&gt;color&lt;/code&gt; property a dynamic value and a similar operation for &lt;code&gt;fontSize&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We can write properties as kebab case too just ensure to wrap them in quotes&lt;/li&gt;
&lt;li&gt;It can be more powerful to directly pass in an object to &lt;code&gt;style&lt;/code&gt; which is a more readable and cleaner method.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The purpose for array syntax in style reduces to allowing us to pass in multiple objects &lt;em&gt;( Duhhh that's what arrays do right :P )&lt;/em&gt; for style as passing a string to style works won't make much sense in the special syntax.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;nav&lt;/span&gt; 
&lt;span class="na"&gt;:style=&lt;/span&gt;&lt;span class="s"&gt;"[marginObject, backgroundObject]"&lt;/span&gt;
&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Doge Coin
&lt;span class="nt"&gt;&amp;lt;/nav&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Bonus Treats
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe9jm5daq0m6yxzs0vxhp.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe9jm5daq0m6yxzs0vxhp.gif" alt="Bonus treats extra vue knowledge" width="245" height="190"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Some CSS properties require us to use vendor prefixes. Vue will apply them for us implicitly but if you want to be explicit you can pass in multiple values for a single property through object syntax and providing an array of values. Vue will only render the last value in the array which the browser supports.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;ul&lt;/span&gt; &lt;span class="na"&gt;:style=&lt;/span&gt;&lt;span class="s"&gt;"{ display: ['-webkit-box', '-ms-flexbox', 'flex'] }"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thanks for reading! :). Please share your thoughts about the array and object syntax would you prefer them over strings?&lt;/p&gt;

&lt;p&gt;Reach out to me on &lt;a href="https://twitter.com/1108King" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; to share your feedback or for any queries. I'd be more than happy to help!&lt;/p&gt;

</description>
      <category>vue</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>css</category>
    </item>
    <item>
      <title>Comprehensive Guide for not so Regular Expressions</title>
      <dc:creator>Lakshya Singh</dc:creator>
      <pubDate>Sun, 16 May 2021 17:47:21 +0000</pubDate>
      <link>https://dev.to/king11/comprehensive-guide-for-not-so-regular-expressions-56f7</link>
      <guid>https://dev.to/king11/comprehensive-guide-for-not-so-regular-expressions-56f7</guid>
      <description>&lt;h2&gt;
  
  
  What is Regex?
&lt;/h2&gt;

&lt;p&gt;Regular expressions ( or regexes, or regex patterns) are essentially a kind of formal grammar/syntax used to find the set of possible strings that you want to match.&lt;/p&gt;

&lt;p&gt;At first, REs can look pretty scary and daunting, but we can write highly efficient matching patterns in terms of length and speed after understanding even a few special characters.&lt;/p&gt;

&lt;p&gt;We can use REs to save the day in a variety of use cases :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Checking a pattern in string&lt;/li&gt;
&lt;li&gt;Splitting into strings&lt;/li&gt;
&lt;li&gt;Replacing part of strings&lt;/li&gt;
&lt;li&gt;Matching a complete string&lt;/li&gt;
&lt;li&gt;Cleaning raw data in Natural Language Processing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd3l5jeoltinem0bc74g8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd3l5jeoltinem0bc74g8.png" alt="Hardcoding string expressions not the right way" width="631" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All major programming languages and even IDEs have their own standard module for regex where the syntax might change, but the underlying concept remains the same.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# python3
&lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;

&lt;span class="n"&gt;pattern&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;compile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;doge&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s"&gt;shen+lo+&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;I&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;pattern&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Doge hennnloo&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Henlo Doge&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// javascript&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;pattern&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/doge&lt;/span&gt;&lt;span class="se"&gt;\s&lt;/span&gt;&lt;span class="sr"&gt;hen+lo+/i&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;pattern&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Doge hennnloo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Henlo Doge&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Let's get started 🚀
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Normal Characters 🇦
&lt;/h3&gt;

&lt;p&gt;You can use regex as you use normal strings/characters for matching too :&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="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;debug&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/king-11/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;king-11&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="c1"&gt;// returns true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But certain special characters have to be escaped because they carry special meaning in regex.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\ / [ ] { } . ? + * ^ $ | ( )&lt;/code&gt;&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="c1"&gt;// we have to escape back slash in string to be tested as well&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;debug&lt;/span&gt;&lt;span class="p"&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="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s1"&gt;/[]{}.?+*^$|()&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="c1"&gt;// returns true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Character Class and Regex Characters 🧑🏼‍🤝‍🧑🏼
&lt;/h3&gt;

&lt;p&gt;A character class allows you to define a set of characters from which a match is considered if any of the characters match.&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="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;aeiou&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;e&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// returns true&lt;/span&gt;
&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;aeiou&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;c&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// returns false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also provide range values to regex for defining character classes using &lt;code&gt;-&lt;/code&gt;.&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="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;l&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// returns true matches all lowercase alphabets&lt;/span&gt;
&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;A&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;Z&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;L&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// returns true matches all uppercase alphabets&lt;/span&gt;
&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;8&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// returns true matches all digits from 0 to 9&lt;/span&gt;
&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;8&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// returns false matches all digits from 0 to 5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But if you want to match &lt;code&gt;-&lt;/code&gt;, you have to escape it or keep it at the start or end of character class, i.e. &lt;code&gt;[]&lt;/code&gt;.&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="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;-&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;span class="c1"&gt;// returns true matches 0, 5, -&lt;/span&gt;
&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;-&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;span class="c1"&gt;// returns true matches digits from 0 to 5 and -&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can define complement character class, i.e. characters we don't want to match, by adding &lt;code&gt;^&lt;/code&gt; at the start of our 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="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;A&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;span class="c1"&gt;// returns true doesn't match any lowercase alphabet&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inside a character class, only two characters carry special meaning &lt;code&gt;-&lt;/code&gt; in-between characters and &lt;code&gt;^&lt;/code&gt; at the start of the class rest all other characters don't carry their special meaning; hence we don't need to escape them.&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="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;$&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// returns true matches $ and +&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can define character classes for things like alphabets and digits but regex makes it easier for you by defining several special regex characters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;\w&lt;/code&gt; [a-zA-Z0-9_] Alphabets and Digits Class&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;\W&lt;/code&gt; [^a-zA-Z0-9_] Negated Class of &lt;code&gt;\w&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;\d&lt;/code&gt; [0-9] Digits Class&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;\D&lt;/code&gt; [^0-9] Negated Class of &lt;code&gt;\d&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;\t&lt;/code&gt; Tab Character&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;\n&lt;/code&gt; Newline Character&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;\s&lt;/code&gt; [ \t\r\f\v\n] Matches all white space characters like space, tab, newline, carriage return, vertical tab, form feed, etc.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;\S&lt;/code&gt; [^\s]&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;\b&lt;/code&gt; Matches Word Boundary where there is a &lt;code&gt;\w&lt;/code&gt; on one side and &lt;code&gt;\W&lt;/code&gt; on other side of position
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fabosozkbi92rlk2e52ac.jpeg" alt="boundary.jpg" width="399" height="150"&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;\B&lt;/code&gt; [^\b] Matches all non Word Boundaries&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Wild 🐯 Cards
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;^&lt;/code&gt; symbol allows us to match the starting of the string &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;$&lt;/code&gt; allows you to match the end of the string&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.&lt;/code&gt; allows us to match any character
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Tall&lt;/span&gt;&lt;span class="dl"&gt;"&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="sr"&gt;/l$/ig&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="c1"&gt;// [ 'l' ]&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Tight&lt;/span&gt;&lt;span class="dl"&gt;"&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="sr"&gt;/^t/ig&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="c1"&gt;// [ 'T' ]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9ye93ro9n5u3d9dkqjb1.png" alt="example regex for end of line" width="198" height="172"&gt;&lt;/th&gt;
&lt;th&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3yfnw5wgzybr25f7xrs6.png" alt="example regex for start of line" width="231" height="165"&gt;&lt;/th&gt;
&lt;th&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkz5s0bc1tubqhkk2km4g.png" alt="example regex comparison" width="206" height="175"&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;In the above example, while &lt;code&gt;l&lt;/code&gt; was matched only with the last one, whereas &lt;code&gt;T&lt;/code&gt; was matched with the first one due to &lt;code&gt;$&lt;/code&gt; and &lt;code&gt;^&lt;/code&gt;, respectively. Without &lt;code&gt;$&lt;/code&gt; as you can see, all the &lt;code&gt;l&lt;/code&gt;s were matched.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;regex&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;compile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ho.dog&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;regex&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hotdog&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# True
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;regex&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hoddog&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# True
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;.&lt;/code&gt; allowed us to match both &lt;code&gt;d&lt;/code&gt; and &lt;code&gt;t&lt;/code&gt; in the above example. All the three wildcards are special characters to match them specifically, i.e. &lt;code&gt;^&lt;/code&gt;, &lt;code&gt;$&lt;/code&gt; and &lt;code&gt;.&lt;/code&gt; you have to escape them using &lt;code&gt;\&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Flags 🎌
&lt;/h3&gt;

&lt;p&gt;You might have observed usage of &lt;code&gt;g&lt;/code&gt; or &lt;code&gt;i&lt;/code&gt; after the regex expression so what are these things?&lt;br&gt;
These are regex flags that affect the number and type of match we want to make :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;i&lt;/strong&gt; -  Case insensitive match which doesn't differentiate &lt;code&gt;t&lt;/code&gt; and &lt;code&gt;T&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;g&lt;/strong&gt; - Global Flag allows us to match more than one instance of our expression and not just the first instance&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;m&lt;/strong&gt; - Multiline Flag affects the behaviour of &lt;code&gt;^&lt;/code&gt; and &lt;code&gt;$&lt;/code&gt; where a &lt;code&gt;\n&lt;/code&gt; newline character would mean the start of a new string
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;  &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;
  &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;^football&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;rugby&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;football&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;I&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;M&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="c1"&gt;# &amp;lt;re.Match object; span=(6, 14), match='football'&amp;gt;
&lt;/span&gt;  &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;^football&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;rugby&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;football&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;I&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="c1"&gt;# None
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;s&lt;/strong&gt; - DotAll Mode, allows wildcard &lt;code&gt;.&lt;/code&gt; to match newline character as well.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;u&lt;/strong&gt; - Unicode support enabled&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Half Way through, but I believe the next half will be easier&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwnxfwzmn2a0wxe0onrcx.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwnxfwzmn2a0wxe0onrcx.gif" alt="Half Way Checkpoint" width="498" height="276"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Quantifiers 3️⃣
&lt;/h3&gt;

&lt;p&gt;Sometimes we require to match a character class, character, group ( coming up ) zero, one, more than one or even, let's say &lt;code&gt;11-22&lt;/code&gt; times ( random numbers ); in such cases, quantifiers come to the rescue:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;?&lt;/code&gt; Matches its preceding character, class or group zero or one time.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;  &lt;span class="n"&gt;regex&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;compile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hot?dog&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;regex&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hotdog&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="c1"&gt;# True
&lt;/span&gt;  &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;regex&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hodog&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="c1"&gt;# True
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;*&lt;/code&gt; Matches its preceding character, class or group zero or more times ( ∞ ).
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;  &lt;span class="n"&gt;regex&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;compile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hot*dog&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;regex&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hotttttdog&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="c1"&gt;# True
&lt;/span&gt;  &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;regex&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hodog&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="c1"&gt;# True
&lt;/span&gt;  &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;regex&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hotog&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="c1"&gt;# True
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;+&lt;/code&gt; Matches its preceding character, class or group one or more times ( ∞ ).
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;  &lt;span class="n"&gt;regex&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;compile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hot+dog&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;regex&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hotttttdog&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="c1"&gt;# True
&lt;/span&gt;  &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;regex&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hodog&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="c1"&gt;# False
&lt;/span&gt;  &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;regex&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hotog&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="c1"&gt;# True
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;{n,m}&lt;/code&gt; Matches its preceding character at least &lt;code&gt;n&lt;/code&gt; times and at most &lt;code&gt;m&lt;/code&gt; times. The default value for &lt;code&gt;n&lt;/code&gt; is &lt;code&gt;0&lt;/code&gt; and the default for &lt;code&gt;m&lt;/code&gt; is &lt;code&gt;&amp;amp;#8734;&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;  &lt;span class="n"&gt;regex&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;compile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hot{1,3}dog&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;regex&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hotdog&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="c1"&gt;# True
&lt;/span&gt;  &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;regex&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hottttdog&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="c1"&gt;# False
&lt;/span&gt;  &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;regex&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hotttog&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="c1"&gt;# True
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Groups ✨
&lt;/h3&gt;

&lt;p&gt;Groups allow us to create grouped expressions that can help us in substitution, referencing them in later parts of a regular expression.&lt;/p&gt;

&lt;p&gt;Let's say we want to replace all the &lt;code&gt;function&lt;/code&gt; with &lt;code&gt;arrow functions&lt;/code&gt;. Obviously, we would like to retain the name of the function and its arguments, but we need to reference them in replacement. With VSCode, our favourite editor and regex, we can do something like :&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;function&lt;/span&gt; &lt;span class="nf"&gt;NotAnArrow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;argument&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;I do something&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxpnt0w61jt1vxa5xchyn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxpnt0w61jt1vxa5xchyn.png" alt="Vscode regular expression" width="421" height="64"&gt;&lt;/a&gt;&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;NotAnArrow&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;argument&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;I do something&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What we used were &lt;code&gt;capturing groups&lt;/code&gt;, which we created using &lt;code&gt;(.+)&lt;/code&gt; and &lt;code&gt;(.*)&lt;/code&gt; ( &lt;code&gt;arguments&lt;/code&gt; might not be there ). Anything inside those brackets forms our group, and the expression inside them is the one that will be matched.&lt;/p&gt;

&lt;p&gt;There are other types of groups as well:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Named Groups &lt;code&gt;(?&amp;lt;Name&amp;gt;...)&lt;/code&gt; is a group that provides us reference to that group using its name instead of numbers&lt;/li&gt;
&lt;li&gt;Non Capturing Groups &lt;code&gt;(?:...)&lt;/code&gt; is a group that will match, but we can't reference them in the result of the regex expression.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Alternation &lt;code&gt;|&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;Alternation is a simple &lt;code&gt;OR&lt;/code&gt; that we can use between different parts of our regex pattern to match this or that or even that by providing different options, just like radio buttons.&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;regex&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;java|type&lt;/span&gt;&lt;span class="se"&gt;)(?:&lt;/span&gt;&lt;span class="sr"&gt;script&lt;/span&gt;&lt;span class="se"&gt;)?&lt;/span&gt;&lt;span class="sr"&gt;|html5&lt;/span&gt;&lt;span class="se"&gt;?&lt;/span&gt;&lt;span class="sr"&gt;|css3&lt;/span&gt;&lt;span class="se"&gt;?&lt;/span&gt;&lt;span class="sr"&gt;|php|c&lt;/span&gt;&lt;span class="se"&gt;(\+\+)?\s&lt;/span&gt;&lt;span class="sr"&gt;/gi&lt;/span&gt;

&lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="s2"&gt;`JavaScript is here but PhP came
before them and now its TypeScript`&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;matchAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;regex&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&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;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c1"&gt;// [ 'TypeScript', 'Type', index: 56, input: 'JavaScript is ..... ]&lt;/span&gt;
&lt;span class="c1"&gt;// .&lt;/span&gt;
&lt;span class="c1"&gt;// .&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So here is what we did with that complex-looking but now easy for you to understand Regular Expression.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Created Group to match both &lt;code&gt;Java&lt;/code&gt;, &lt;code&gt;Javascript&lt;/code&gt; and &lt;code&gt;Typescript&lt;/code&gt; using &lt;code&gt;|&lt;/code&gt; and &lt;code&gt;?&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Used &lt;code&gt;|&lt;/code&gt; to match other languages as well&lt;/li&gt;
&lt;li&gt;Escaped &lt;code&gt;+&lt;/code&gt; to match for &lt;code&gt;C++&lt;/code&gt; and &lt;code&gt;C&lt;/code&gt; as well using &lt;code&gt;?&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Finally, a character class &lt;code&gt;\s&lt;/code&gt; to signify the end of the language name&lt;/li&gt;
&lt;li&gt;Flags like &lt;code&gt;gi&lt;/code&gt; to match all languages and irrespective of case&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Usually, you will find yourself using &lt;code&gt;|&lt;/code&gt; inside of groups as you wouldn't want to pollute your global regex just like you always use virtual environment. Make sure to make them &lt;code&gt;non capturing&lt;/code&gt; if you don't want to reference or find them in your results.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Trick 🎃 Treat
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;+&lt;/code&gt; and &lt;code&gt;*&lt;/code&gt; are of nature greedy. They will keep adding characters to the match until they find the last instance of any succeeding expression or the sentence ends.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;
&lt;span class="n"&gt;regex&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;compile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;(a|m).+e&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;regex&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;apple maple&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="c1"&gt;# expected ['apple','maple'] found 'apple maple'
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here &lt;code&gt;.+&lt;/code&gt; ignored the &lt;code&gt;e&lt;/code&gt; of &lt;code&gt;apple&lt;/code&gt; and went all the way to finish at &lt;code&gt;e&lt;/code&gt; of &lt;code&gt;maple&lt;/code&gt; as it was the last instance of &lt;code&gt;e&lt;/code&gt; that it was able to find.&lt;/p&gt;

&lt;p&gt;Lazy Mode for &lt;code&gt;*&lt;/code&gt; and &lt;code&gt;+&lt;/code&gt; can be activated by appending &lt;code&gt;?&lt;/code&gt; after the quantifier matches only the minimum required characters for the regex expression.&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;regex&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|m&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;e/gi&lt;/span&gt;

&lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;apple mapple&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;matchAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;regex&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&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;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c1"&gt;// expected ['apple','maple'] found ['apple' 'maple']&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I highly recommend you to check language-specific docs for syntax and available features. One of the best docs for regex is for &lt;a href="https://docs.python.org/3/howto/regex.html" rel="noopener noreferrer"&gt;python&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;I didn't cover one feature that I might make a new article on it is &lt;a href="https://javascript.info/regexp-lookahead-lookbehind" rel="noopener noreferrer"&gt;Lookahead and Lookbehind&lt;/a&gt;. You can wait :) or check out the link.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F94p070hxss9t0bak6okt.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F94p070hxss9t0bak6okt.gif" alt="Use regex carefully due to backtracking and recursive nature" width="480" height="256"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Why did I say that? Because sometimes regex can take exponential time to search a be really &lt;a href="https://javascript.info/regexp-catastrophic-backtracking" rel="noopener noreferrer"&gt;catastrophic&lt;/a&gt;. So .....&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;May the code be with you 🖖&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>javascript</category>
      <category>python</category>
      <category>machinelearning</category>
      <category>regex</category>
    </item>
    <item>
      <title>Good Git Commits</title>
      <dc:creator>Lakshya Singh</dc:creator>
      <pubDate>Fri, 07 May 2021 09:37:29 +0000</pubDate>
      <link>https://dev.to/king11/good-git-commits-2deo</link>
      <guid>https://dev.to/king11/good-git-commits-2deo</guid>
      <description>&lt;p&gt;Git commits are everywhere, and you might be generating more than 1k commits over a year. So it becomes crucial to understand that commit should be structured and created in a scalable manner.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F30qsglopgioj7asgrt1p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F30qsglopgioj7asgrt1p.png" alt="commit.png" width="525" height="311"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why bother?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Writing better commits can make the difference between your debugging session lasting &lt;strong&gt;1 hour to a few minutes&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;With good commits, it's easier for anyone to understand the progress of a project and get up to speed. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It also allows reviewers to understand your progress during the resolution of an issue clearly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Generating good commits will allow you to track back changes/issues to a specific module/file and associate it to the code easily.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;They enable you to understand how the issue crept in the codebase and how you can easily resolve it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Good commit messages can save you the hassle while creating release notes&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What are good commits?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Modular
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkmae1n5tcyvqczufjk1c.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkmae1n5tcyvqczufjk1c.jpeg" alt="Modular Commits" width="600" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A commit should be &lt;strong&gt;modular&lt;/strong&gt; in nature, just like our codebase. Each commit should &lt;strong&gt;encapsulate&lt;/strong&gt; a single logical idea only that might span over several changes but as a whole is a single related group of changes.&lt;/p&gt;

&lt;p&gt;E.g., add CSS to a component, change the margin of all pages, strong typing your functions, etc.&lt;/p&gt;

&lt;h3&gt;
  
  
  Type of Commit
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Categorising&lt;/strong&gt; your commits into types will clarify what type of change it made and be instantly identified. I usually keep a template file that contains those types, so I don't have to remember them :P&lt;/p&gt;

&lt;p&gt;Some of the subtypes can be a chore, feat, fix, refactor, style, etc. What meaning does each carry can vary based on your team or you as an individual as well. Below are the types that I use in my commits :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  feat: new feature&lt;/li&gt;
&lt;li&gt;  fix: bug fix&lt;/li&gt;
&lt;li&gt;  refactor: refactoring production code&lt;/li&gt;
&lt;li&gt;  style: formatting, missing semicolons, etc.; no code change&lt;/li&gt;
&lt;li&gt;  docs: changes to documentation&lt;/li&gt;
&lt;li&gt;  test: adding or refactoring tests no production code change&lt;/li&gt;
&lt;li&gt;  chore: updating dependencies etc. no production code change&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Description
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fztlzzzj251occgp1a8xz.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fztlzzzj251occgp1a8xz.gif" alt="Perfect Description" width="480" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A commit message except for the subject line limited to &lt;code&gt;50&lt;/code&gt; chars should include a description broken into &lt;code&gt;72&lt;/code&gt; char lines/line. The description is separated from the subject by a blank line. The description should try to cover things like :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the current behaviour,&lt;/li&gt;
&lt;li&gt;what change are you making?&lt;/li&gt;
&lt;li&gt;why this fix is needed?&lt;/li&gt;
&lt;li&gt;why take the current approach for this change?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Commit message should be in the future tense, i.e. 'Fix' vs 'Fixed.' &lt;/p&gt;

&lt;h2&gt;
  
  
  Bonus Treats
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5rgbqxm52q67sojtrt4q.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5rgbqxm52q67sojtrt4q.gif" alt="Treat" width="480" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can specify a template for your git commits by adding the following config to your &lt;code&gt;$HOME/.gitconfig&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;[&lt;/span&gt;commit]
    template &lt;span class="o"&gt;=&lt;/span&gt; ~/path/to/template
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;My template looks like this, which allows constraining the number of characters in the subject and description line. I also add the types and just in case I don't remember :'(&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# &amp;lt;type&amp;gt;: &amp;lt;subject&amp;gt;&lt;/span&gt;
&lt;span class="c"&gt;##### Subject 50 characters ################# -&amp;gt; |&lt;/span&gt;


&lt;span class="c"&gt;# Body Message&lt;/span&gt;
&lt;span class="c"&gt;######## Body 72 characters ####################################### -&amp;gt; |&lt;/span&gt;

&lt;span class="c"&gt;# --- COMMIT END ---&lt;/span&gt;
&lt;span class="c"&gt;# Type can be&lt;/span&gt;
&lt;span class="c"&gt;#   feat    : new feature&lt;/span&gt;
&lt;span class="c"&gt;#   fix     : bug fix&lt;/span&gt;
&lt;span class="c"&gt;#   refactor: refactoring production code&lt;/span&gt;
&lt;span class="c"&gt;#   style   : formatting, missing semi colons, etc; no code change&lt;/span&gt;
&lt;span class="c"&gt;#   docs    : changes to documentation&lt;/span&gt;
&lt;span class="c"&gt;#   test    : adding or refactoring tests&lt;/span&gt;
&lt;span class="c"&gt;#             no production code change&lt;/span&gt;
&lt;span class="c"&gt;#   chore   : updating grunt tasks etc&lt;/span&gt;
&lt;span class="c"&gt;#             no production code change&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;/em&gt;: For your template to be prompted, you have to use &lt;code&gt;git commit&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is my first post hope you liked it =)&lt;/em&gt;&lt;/p&gt;

</description>
      <category>github</category>
      <category>git</category>
      <category>firstpost</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
