<?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: Svenja Schäfer</title>
    <description>The latest articles on DEV Community by Svenja Schäfer (@s_slickepinne).</description>
    <link>https://dev.to/s_slickepinne</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%2F341480%2F7a6d76d3-7e49-4144-b827-c236b4c2fce9.jpeg</url>
      <title>DEV Community: Svenja Schäfer</title>
      <link>https://dev.to/s_slickepinne</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/s_slickepinne"/>
    <language>en</language>
    <item>
      <title>3 Question Framework – How to Respond Without Reacting</title>
      <dc:creator>Svenja Schäfer</dc:creator>
      <pubDate>Sun, 02 Feb 2025 22:10:43 +0000</pubDate>
      <link>https://dev.to/s_slickepinne/3-question-framework-how-to-respond-without-reacting-4f89</link>
      <guid>https://dev.to/s_slickepinne/3-question-framework-how-to-respond-without-reacting-4f89</guid>
      <description>&lt;p&gt;&lt;em&gt;First published on &lt;a href="https://thoughtbot.com/blog/3-question-framework-how-to-respond-without-reacting" rel="noopener noreferrer"&gt;thoughtbot&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Last year, in 2023, I applied internally for a Development Team Lead position – and got the job 🎉. Basically that means that I manage wonderful folks on top of continuing to work as a developer and consultant. My add-on focus, so to say, is that I work with my teammates to identify areas for growth, ways to maintain and raise their level of fulfillment, and to give and receive feedback. We also catch up about what’s going on in our lives and how we feel, in general.&lt;/p&gt;

&lt;p&gt;The idea behind the 3 question framework is a result of one such meeting I had with a teammate I support. We were discussing experiences we both had where we felt we didn’t work efficiently because we were constantly answering questions and reacting to comments on Slack. We do this because we really care about one another and we find fulfillment in helping others. But in doing so, we didn’t give others the chance to contribute or to find answers on their own. On top of that, it was frustrating as we were slower in finishing our own tasks.&lt;/p&gt;

&lt;p&gt;After that meeting, I thought about a way to prevent this from happening. It wasn’t as easy as just saying “stop reacting to posts, focus on your own tasks” because as I mentioned it fulfills us to help and we definitely don’t want to stop doing it. A balance was needed. That balance called “3 Question Framework”.&lt;/p&gt;

&lt;h2&gt;
  
  
  THE FRAMEWORK
&lt;/h2&gt;

&lt;p&gt;As the name implies, the framework consists of three questions to ask when you find yourself reading comments or inquiries that give you the urge to react to them. These are the questions:&lt;/p&gt;

&lt;p&gt;Is the comment or question directly related to my work?&lt;br&gt;
Can the author answer the question themself?&lt;br&gt;
Is there someone around who can answer?&lt;br&gt;
Although we have three questions, you might be done with the framework after answering the first. If you answer with “no, this is not directly related to my work”, then you have to force yourself to bring your focus to your own task. Do not react to the question.&lt;/p&gt;

&lt;p&gt;If the comment is related to your task, move to the second question from the framework: can the writer answer the question themself? Maybe they are looking for a document or similar and are asking if someone knows where to find it off the top of their head. If this is the case and you would need to search for it as well, you do not react to it.&lt;/p&gt;

&lt;p&gt;If they can’t answer it by themselves and given that it is related directly to your work, you go to the third and last question: are there other folks in the team who can react to the post. If there are, give them the chance to answer – and I use “chance” intentionally. You keep yourself in the background and focus on your task.&lt;/p&gt;

&lt;p&gt;Finally, if there is a post that is directly linked to your work where the author can’t proceed without input from you alone, that is the only time when you will answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  THE IDEAL
&lt;/h2&gt;

&lt;p&gt;Ideally, you don’t want to use this framework forever. You should use it as a method to trick your brain into not reacting the known way: immediately reacting to every message. I can say that it helped my teammate and myself. If you are worried you might come across as rude, you can inform your colleagues that you are trying out this framework. And if you did use it, let me know what you think and if it helped you or your mates.&lt;/p&gt;

</description>
      <category>communication</category>
      <category>coaching</category>
    </item>
    <item>
      <title>Understanding Regular Expressions once and for all [PART 4]</title>
      <dc:creator>Svenja Schäfer</dc:creator>
      <pubDate>Mon, 17 Aug 2020 07:17:56 +0000</pubDate>
      <link>https://dev.to/codegram/understanding-regular-expressions-once-and-for-all-part-4-5gab</link>
      <guid>https://dev.to/codegram/understanding-regular-expressions-once-and-for-all-part-4-5gab</guid>
      <description>&lt;p&gt;Originally published at: &lt;a href="https://www.codegram.com/blog/understanding-regex-once-and-for-all-part-four/" rel="noopener noreferrer"&gt;Codegram's blog&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here comes part 4 of the &lt;a href="https://www.codegram.com/blog/tag/reg-ex/" rel="noopener noreferrer"&gt;&lt;strong&gt;"Understanding Regular Expressions once and for all"&lt;/strong&gt;&lt;/a&gt; series. Until now, you should be able to match literal characters, numbers, spaces at the end and beginning of a line. Also, you are aware of the optional character - the question mark. And you can check if a character appears minimum once or zero times thanks to &lt;code&gt;+&lt;/code&gt; and &lt;code&gt;*&lt;/code&gt;. So far, so good. Today, it's time to meet brackets.&lt;/p&gt;

&lt;h3&gt;
  
  
  DINNER WITH [FRIENDS]
&lt;/h3&gt;

&lt;p&gt;Imagine some friends will come over for dinner. And you have to prepare the evening, including - of course - the dinner itself. You look through all the recipes but this time it's not super important what you cook (ingredients), but for how many people it is. Our task: only matching recipes for the number of friends coming over. Let's say, 5 friends will sit at the table tonight. We could write something like this: &lt;code&gt;servings: 5&lt;/code&gt;. But while this is a totally accepted expression, we want to make it a bit more "regex-like". Also, there's always this type of friend who brings someone with and another might cancel, so a range would be better suited. Ranges can look like this: &lt;code&gt;[0-3]&lt;/code&gt;. So, our expression could be: &lt;code&gt;servings:\s[4-6]&lt;/code&gt;. With this, we would match the recipes for 4, 5 and 6 people. &lt;/p&gt;

&lt;p&gt;But what if we run a nice vegan BBQ party? We expect to see about 12 - 16 people. How can we match that? Remember, that we match a single character. Always. If we want to match more, we specifically have to say it. We could end up with something like this: &lt;code&gt;servings:\s[0-9]+&lt;/code&gt; but with that, we would actually match any amount. Useless. We could, however, write this: &lt;code&gt;servings:\s[1][2-6]&lt;/code&gt;. Nice, isn't it? &lt;/p&gt;

&lt;p&gt;The square brackets also work with any other character. For example, if we want to match all recipes starting with a capital B (like the B in BBQ), we could use this expression: &lt;code&gt;^B&lt;/code&gt;, right? But what, if the recipes we are looking for are ordered under G (like in Grilling)? Easy-peasy with our square brackets: &lt;code&gt;^[BG]&lt;/code&gt;. You see, it doesn't have to be a range we are looking for. Any character inside the square brackets &lt;strong&gt;can&lt;/strong&gt; be a match. Can, not must! &lt;/p&gt;

&lt;h3&gt;
  
  
  EXCEPTIONS, EXCEPTIONS
&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%2Fi%2Fpvc24ntjy609nj2yxgnx.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%2Fi%2Fpvc24ntjy609nj2yxgnx.jpg" alt=" " width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Did you see in the previous expression, that the caret character is outside the square brackets? That's not an error but has a good reason. If it were inside like this: &lt;code&gt;[^BG]&lt;/code&gt;, we would match any recipe that doesn't have a B or G. The &lt;code&gt;^&lt;/code&gt; inside square brackets means &lt;strong&gt;not&lt;/strong&gt;. Sure, we can use this as well. For example, like this: &lt;code&gt;^[^AC-FH-Z]&lt;/code&gt;. With that, we wouldn't match any starting uppercase letter besides B and G. To exclude any lowercase characters as well, we could change the expression into: &lt;code&gt;^[^a-zAC-FH-Z]&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;Yes, square brackets are pretty useful and like the rest of regular expressions powerful. But there are more. More brackets. Curly ones for example.&lt;/p&gt;

&lt;p&gt;Remember, when we covered matching &lt;strong&gt;multiple digits&lt;/strong&gt; in &lt;a href="https://www.codegram.com/blog/understanding-regex-once-and-for-all-part-three/" rel="noopener noreferrer"&gt;Part 3&lt;/a&gt; of this blog series? We used &lt;code&gt;*&lt;/code&gt; or &lt;code&gt;+&lt;/code&gt; for it. But what if we don't want to end up with endless repetitions of a character but matching a specific amount? Say hello to &lt;code&gt;{}&lt;/code&gt;. Whichever character length you want to define, this is the expression for it. So maybe we want to find all digits with the length of 4 in our recipe, like &lt;em&gt;1000 ml.&lt;/em&gt; Just because we want to change it into &lt;em&gt;1 litre&lt;/em&gt;. We could write &lt;code&gt;\d{4}&lt;/code&gt;. Even ranges are possible with these neat brackets. To match minimum four and maximum six characters, the regular expression would look like this: &lt;code&gt;\d{4,6}&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;See, with only two types of brackets, you can be so much more precise. Imagine what you can do with three types. That's exactly what we will learn in the next part. But until then:&lt;br&gt;
&lt;code&gt;^Ke{2}p\s[n-p]+\slearning$&lt;/code&gt;.&lt;/p&gt;




&lt;p&gt;Photos by &lt;a href="https://unsplash.com/@jruscello" rel="noopener noreferrer"&gt;Jessica Ruscello&lt;/a&gt; on &lt;a href="https://unsplash.com/" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

</description>
      <category>regex</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Rails Engines - Independent Heroes</title>
      <dc:creator>Svenja Schäfer</dc:creator>
      <pubDate>Thu, 28 May 2020 18:36:12 +0000</pubDate>
      <link>https://dev.to/codegram/rails-engines-independent-heroes-4bdh</link>
      <guid>https://dev.to/codegram/rails-engines-independent-heroes-4bdh</guid>
      <description>&lt;p&gt;Originally published at: &lt;a href="https://www.codegram.com/blog/rails-engines-independent-heroes/" rel="noopener noreferrer"&gt;Codegram's blog&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you have built a Rails &lt;em&gt;application&lt;/em&gt; in the past, chances are that you used Rails engines already – maybe unknowingly. The well-known &lt;a href="https://github.com/heartcombo/devise" rel="noopener noreferrer"&gt;devise&lt;/a&gt; &lt;code&gt;gem&lt;/code&gt;, for example, is based on Rails engines. But what is it exactly? Well, simply put a Rails &lt;code&gt;engine&lt;/code&gt; is the &lt;strong&gt;miniature edition&lt;/strong&gt; of a Rails &lt;em&gt;application&lt;/em&gt;. It comes with an &lt;code&gt;app&lt;/code&gt; folder, including controllers, models, views, routes, migrations... The difference though is, that an &lt;code&gt;engine&lt;/code&gt; won't work on its own. To show what it's capable of, it needs to become part of something bigger - a part of a main Rails &lt;em&gt;application&lt;/em&gt;. &lt;/p&gt;

&lt;h3&gt;
  
  
  THE POWER OF INDEPENDENCE
&lt;/h3&gt;

&lt;p&gt;I can hear your question: if we still need a main application and an &lt;code&gt;engine&lt;/code&gt; is just a small edition of it, why do we need it in the first place?&lt;/p&gt;

&lt;p&gt;Well, let me tell you of a van I bought a few years ago. A 1984 Volkswagen LT. Huge, kind of old, lots of adjustments made by more or less experienced former owners with a lack of documentation. Sounds familiar? This could be true for some larger &lt;em&gt;applications&lt;/em&gt; as well.&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%2Fi%2Frbt1mwser155oag7wy0t.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%2Fi%2Frbt1mwser155oag7wy0t.jpg" alt="Photo by Tobias Tullius on Unsplash" width="800" height="531"&gt;&lt;/a&gt;&lt;br&gt;
&lt;small&gt;Like this one, only in red. Photo by &lt;a href="https://unsplash.com/@tobiastu" rel="noopener noreferrer"&gt;Tobias Tullius&lt;/a&gt; on &lt;a href="https://unsplash.com/" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;

&lt;p&gt;When an app starts to grow, when it becomes huge, one can get confused. You are scared to touch file "A" because it is somehow related to file "S" and file "P". Maybe that's not even the case any longer! Maybe you don't need the file "S" any more. Fact is, bigger applications can drive you nuts easily. Wouldn't it be better, if you could &lt;strong&gt;separate&lt;/strong&gt; some components? Wouldn't it be better if I could fix, test and improve the wires of my van without the need of the actual van? Or the motor? Sure, it would. And that's exactly why you might want to think about using Rails engines. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You have a nice, clear structure where tasks are separated into different components&lt;/li&gt;
&lt;li&gt;You can and will test them on their own&lt;/li&gt;
&lt;li&gt;You can add and remove engines at will from/to your main application&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;But, same with everything in life, big decisions (&lt;em&gt;outsourcing parts of a larger application into &lt;code&gt;engines&lt;/code&gt; is one of these decisions&lt;/em&gt;) come with a good portion of responsibility.&lt;/p&gt;

&lt;h3&gt;
  
  
  YOU'RE ALLOWED TO EAT ANYTHING BUT NOT TO KNOW EVERYTHING
&lt;/h3&gt;

&lt;p&gt;With &lt;code&gt;engines&lt;/code&gt; it's the same as with that German phrase: they can include anything (controllers, models, gems, routes, migrations, ...) but they must &lt;strong&gt;not&lt;/strong&gt; know about any behaviour of the main &lt;em&gt;application&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;What does that mean? Well, I told you about my van. Like any other car or van, it has a fuel system. This system should work. No matter if it's part of my van, your car or my Dads' bus. It should function totally independent and it should &lt;strong&gt;not&lt;/strong&gt; care about the global picture – in this case, the car, van, bus. &lt;em&gt;If&lt;/em&gt; it cared about it, yes, if it even would rely on the outer shell, what's the idea of having it separated in the first place? Why not creating a fuel system individually made for each car? Sure, that wouldn't make sense at all. And that's why it doesn't make sense for our &lt;code&gt;engines&lt;/code&gt; either. Use them as &lt;strong&gt;independent&lt;/strong&gt; heroes for your main &lt;em&gt;application&lt;/em&gt;, and don't mix up responsibilities. &lt;/p&gt;

&lt;p&gt;Once you are aware of that, the next thing you want to take care of, is the testing part. Actually, it's kind of the same: you have an independent miniature application that should function on its own, 100% apart from any main &lt;em&gt;application. S*o, the most obvious solution is testing it separately, right? Right. As the &lt;code&gt;engine&lt;/code&gt; shouldn't know about anything of the main *application&lt;/em&gt;, stick to tests that are important to that &lt;code&gt;engine&lt;/code&gt;. That doesn't mean you shouldn't have tests that cover the integration of the &lt;code&gt;engine&lt;/code&gt; but these tests should sit inside the main application, not inside the &lt;code&gt;engine&lt;/code&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%2Fi%2F8vc1j33l1j3so9ikq70l.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%2Fi%2F8vc1j33l1j3so9ikq70l.jpg" alt="Photo by Ashutosh Dave on Unsplash" width="800" height="533"&gt;&lt;/a&gt;&lt;br&gt;
&lt;small&gt;Photo by &lt;a href="https://unsplash.com/@ashu" rel="noopener noreferrer"&gt;Ashutosh Dave&lt;/a&gt; on &lt;a href="https://unsplash.com/" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;

&lt;p&gt;The first step is always the hardest. But let me give you some resources that will make it easier. For a good technical overview, I'd suggest following the official &lt;a href="https://guides.rubyonrails.org/engines.html" rel="noopener noreferrer"&gt;Rails engines tutorial&lt;/a&gt;. This shouldn't take too long as you already know what &lt;code&gt;engines&lt;/code&gt; are. You also can read about "component-based rails &lt;em&gt;applications&lt;/em&gt;" as they use rails &lt;code&gt;engines&lt;/code&gt; quite often. Once you feel more confident and aren't afraid of a challenge, head over to &lt;strong&gt;&lt;a href="https://github.com/decidim/decidim" rel="noopener noreferrer"&gt;decidim - The participatory democracy framework&lt;/a&gt;&lt;/strong&gt;. It's an open-source &lt;em&gt;application&lt;/em&gt; that is fully based on &lt;code&gt;engines&lt;/code&gt;. Fully means fully so it might feel a bit overwhelming at the beginning. But as it's open-source, you can see &lt;strong&gt;and&lt;/strong&gt; use the whole code. There's also a detailed documentation included, so don't be afraid and give it a try!&lt;/p&gt;

&lt;p&gt;And finally, if you want to know why decidim looks the way it looks like and why it's based on &lt;code&gt;engines&lt;/code&gt;, read the case study on: &lt;a href="https://www.codegram.com/our-work/decidim/" rel="noopener noreferrer"&gt;codegram - Bringing institutions and people closer together&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In case you have questions and/or suggestions, I'm happy to hear from you! &lt;/p&gt;




&lt;p&gt;&lt;em&gt;Photo by &lt;a href="https://unsplash.com/@shimikumi32" rel="noopener noreferrer"&gt;Kumiko SHIMIZU&lt;/a&gt; on &lt;a href="https://unsplash.com/" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>rails</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Understanding Regular Expressions once and for all [PART 3]</title>
      <dc:creator>Svenja Schäfer</dc:creator>
      <pubDate>Fri, 08 May 2020 16:40:26 +0000</pubDate>
      <link>https://dev.to/codegram/understanding-regular-expressions-once-and-for-all-part-3-5919</link>
      <guid>https://dev.to/codegram/understanding-regular-expressions-once-and-for-all-part-3-5919</guid>
      <description>&lt;p&gt;Originally published at: &lt;a href="https://www.codegram.com/blog/understanding-regex-once-and-for-all-part-three/" rel="noopener noreferrer"&gt;Codegram's blog&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Welcome back to the third edition of Understanding Regular Expressions once and for all. By now, you shouldn't freak out any longer when seeing something like this: &lt;code&gt;/^\d$/&lt;/code&gt;. In case you are really scared, you might want to read the first parts of this series (again): &lt;a href="https://www.codegram.com/blog/understanding-regex-once-and-for-all-part-one/" rel="noopener noreferrer"&gt;Understanding Regular Expressions once and for all [PART 1]&lt;/a&gt; and &lt;a href="https://www.codegram.com/blog/understanding-regex-once-and-for-all-part-two/" rel="noopener noreferrer"&gt;Understanding Regular Expressions once and for all [PART 2]&lt;/a&gt;. If you are just a little bit unsure, let me recap what we've learned:&lt;/p&gt;

&lt;h3&gt;
  
  
  HEATING UP
&lt;/h3&gt;

&lt;p&gt;These are the characters we know about (and don't forget the literal characters):&lt;/p&gt;

&lt;p&gt;&lt;code&gt;^&lt;/code&gt; - the hat/caret character matches characters at the start of a line/string &lt;/p&gt;

&lt;p&gt;&lt;code&gt;$&lt;/code&gt; - the dollar sign matches characters at the end of a line/string&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\w&lt;/code&gt; - matches word (alphanumeric) characters (including underscores)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\d&lt;/code&gt; - matches digits&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\s&lt;/code&gt; - matches whitespaces and line breaks&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\b&lt;/code&gt; - the word boundary pattern&lt;/p&gt;

&lt;p&gt;&lt;code&gt;.&lt;/code&gt; - matches any character except line breaks&lt;/p&gt;

&lt;p&gt;And here's the &lt;strong&gt;most important sentence&lt;/strong&gt; from part 1: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Do not read the word itself but each character separated.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;With that in mind, let's have a look at the expression from the beginning: &lt;code&gt;/^\d$/&lt;/code&gt;. We have the opening slash which indicates that a regular expression starts. After that, we see the caret character. So the character we are looking for is located at the very beginning of a line. The following backslash should make you aware that the next character is somehow important. As it's a &lt;code&gt;d&lt;/code&gt;, we know, it's an expression to match digits. The last regular expression is the dollar sign which means, the digit must sit at the end of a line. Confused? Great. &lt;code&gt;/^\d$/&lt;/code&gt; doesn't mean anything else than matching these options:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1
2
3
4
5
6
7
8
9
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There is &lt;strong&gt;no character&lt;/strong&gt; before the digit, nor after. Just the numbers 0 to 9. &lt;br&gt;
Truth be told, most of the time, we want more. A single character is a bit lame.&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%2Fi%2Fhfygmzsbozldaif7p7ha.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%2Fi%2Fhfygmzsbozldaif7p7ha.jpg" alt="Photo by Lucas Myers on Unsplash" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  GOOD THINGS COME IN THREES
&lt;/h3&gt;

&lt;p&gt;Spoon, knife, fork. Yellow, red, blue. Regular expression quantifiers. Well, honestly, there are a lot more than three, but the three quantifiers I'll show you here today are a fabulous start. Just believe me.&lt;/p&gt;

&lt;p&gt;As we said, &lt;code&gt;/^\d$/&lt;/code&gt; will match a single character only. But, and see how easily I get the transition to my second favourite topic: food (right after regular expressions), what if we are looking for all digits at the beginning of an ingredients list? It makes a huge difference, if you have to use 1 tablespoon of soy sauce or 10, right? Right. So how do we do that? We know it must be at the beginning of a line, so the caret should definitely be part of it. And the expression to match digits. So far, our regular expression would look like this: &lt;code&gt;/^\d/&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;And here's the recipe we'll work with today:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Vegan Mayonnaise&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;120 g Cashew nuts&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;60 ml Olive oil&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;125 ml Oat milk&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;2 tsp Apple vinegar&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;1 tsp Maple syrup (or another sweetener of your choice)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Salt&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;We would match 1, 6, 1, 2 and 1. That's bad. I don't wanna know what mayonnaise tastes like with 1 cashew nut, 6 ml olive oil and 1 ml oat milk. So, we want to match all digits. Say hello to the &lt;code&gt;+&lt;/code&gt; character. The plus sign indicates that the preceding character will be there &lt;strong&gt;minimum once&lt;/strong&gt; but maximum endlessly. Important is the &lt;strong&gt;minimum once&lt;/strong&gt; part. So if we end up with a regular expression like this: &lt;code&gt;/^\d+/&lt;/code&gt; we would match all the digits at the beginning of each line: 120. 60, 125, 2 and 1. The &lt;code&gt;+&lt;/code&gt; can be used for every other regular expression as well. For example &lt;code&gt;/Mayon+aise/&lt;/code&gt; would match &lt;strong&gt;Mayonnaise&lt;/strong&gt;, &lt;strong&gt;Mayonaise&lt;/strong&gt; and even &lt;strong&gt;Mayonnnnnnnaise&lt;/strong&gt;. But not &lt;strong&gt;Mayoaise&lt;/strong&gt;. And let's be honest, who doesn't have trouble with this word and prefer sticking to the short version Mayo instead?! &lt;/p&gt;

&lt;p&gt;Okay, with the &lt;code&gt;+&lt;/code&gt; sign, we finally caught all our ingredients. Kinda. We're missing the salt. Personally, I like salt, so I don't want to miss this part of the recipe either. But, instead of &lt;code&gt;+&lt;/code&gt; where the digit must exist minimum once, I can use &lt;code&gt;*&lt;/code&gt; . When using the &lt;em&gt;asterisk&lt;/em&gt;, or (little) star, the preceding character gets matched &lt;strong&gt;minimum zero&lt;/strong&gt; but &lt;strong&gt;maximum endlessly&lt;/strong&gt; times. So with &lt;code&gt;/^\d*/&lt;/code&gt;, we would get the ingredients that use a number and the ones without. And with the &lt;code&gt;*&lt;/code&gt; character, we covered two of three exciting quantifiers.&lt;/p&gt;

&lt;h3&gt;
  
  
  NOT SURE?
&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%2Fi%2Fs488i4fxo2fzbbi20t34.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%2Fi%2Fs488i4fxo2fzbbi20t34.jpg" alt="Photo by Jon Tyson on Unsplash" width="800" height="1066"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The third quantifier is fairly similar to the asterisk (&lt;code&gt;*&lt;/code&gt;) sign. You use it when you're not sure if the character before it is there or not. The difference is, that if the character exists, it will exist &lt;strong&gt;once&lt;/strong&gt;, not two, three or endless times. And it looks like this: &lt;code&gt;?&lt;/code&gt;. A question mark. The word Mayonnaise is a nice example for this one again. Two or one "n"s? I said, that we match the anterior character, so what would the regular expression look like? &lt;br&gt;
If you have something like this &lt;code&gt;/Mayon?aise/&lt;/code&gt; I must ask you to give it another try. At least if we want to match the correct spelling. Remember, the &lt;code&gt;?&lt;/code&gt; matches characters that exist &lt;strong&gt;minimum zero&lt;/strong&gt; times but &lt;strong&gt;maximum one&lt;/strong&gt; time. The correct regular expression would be this: &lt;code&gt;/Mayonn?aise/&lt;/code&gt;: maybe the second "n" exists, maybe not. &lt;/p&gt;

&lt;p&gt;I hope there aren't any more question marks over your head for the moment. But if so, don't hesitate to reach out to us! And get excited for the next part of &lt;strong&gt;Understanding Regular Expressions once and for all&lt;/strong&gt;.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Photo by &lt;a href="https://unsplash.com/@mitchel3uo?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Mitchell Luo &lt;/a&gt; on &lt;a href="https://unsplash.com/photos/WwCTFNpZx8g" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>regex</category>
    </item>
    <item>
      <title>Understanding Regular Expressions once and for all [PART 2]</title>
      <dc:creator>Svenja Schäfer</dc:creator>
      <pubDate>Tue, 28 Apr 2020 16:19:21 +0000</pubDate>
      <link>https://dev.to/codegram/understanding-regular-expressions-once-and-for-all-part-2-c9i</link>
      <guid>https://dev.to/codegram/understanding-regular-expressions-once-and-for-all-part-2-c9i</guid>
      <description>&lt;p&gt;Originally published at: &lt;a href="https://www.codegram.com/blog/understanding-regex-once-and-for-all-part-two" rel="noopener noreferrer"&gt;Codegram's blog&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Welcome back to &lt;strong&gt;Understanding Regular Expressions once and for all [PART 2]&lt;/strong&gt;. The first post covered some basic regular expressions, like literal characters, the caret (&lt;code&gt;^&lt;/code&gt;) and the dollar sign (&lt;code&gt;$&lt;/code&gt;). If you have missed it, check it here:  &lt;a href="https://www.codegram.com/blog/understanding-regex-once-and-for-all-part-one/" rel="noopener noreferrer"&gt;Understanding Regular Expressions once and for all [PART 1]&lt;/a&gt;. If you are ready, let's grab our food bowl and start with some delicious regular expressions.&lt;/p&gt;

&lt;h3&gt;
  
  
  IT'S ALL ABOUT THE CHARACTER
&lt;/h3&gt;

&lt;p&gt;Well, firstly I think we'll need a new example. And as I want to stay in the food section, I think a whole recipe might do the trick. &lt;em&gt;Remember, you can copy and paste it to your editor of choice and follow along.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;Scrambled Tofu (15 minutes)

Easy to prepare and super delicious. A vegan scrambled eggs alternative. 
Give it a try!

WHAT YOU NEED:

2 tbsp oil
1 small red onion (chopped)
2 garlic cloves (minced)
400 g silken tofu
1 1/2 tbsp tamari/any other soy sauce
1 tbsp nutritional yeast
1/4 tsp curcuma
salt 

OPTIONAL:
tomatoes
mushrooms
spinach

INSTRUCTIONS:

1. Heat a (non-stick) pan.
2. Add oil and onion and stir until onions turn translucent. 
3. Add garlic and stir another minute.
4. Add silken tofu - you don't need to worry about the liquid.
5. Add tamari, nutritional yeast, curcuma and salt.
6. Stir until everything is combined.
7. Cook with medium heat until some liquid vaporized.
8. Serve with bread and vegan butter.

Write a comment on www.write_your_opinion.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, by now we should have a fair understanding of &lt;code&gt;literal characters&lt;/code&gt; inside regular expressions. Means, all of you should know that &lt;code&gt;/oil/&lt;/code&gt; would match all characters in our recipe that contains &lt;strong&gt;o, i,&lt;/strong&gt; and &lt;strong&gt;l&lt;/strong&gt; (&lt;em&gt;in exactly that order&lt;/em&gt;). But sometimes, we don't want to be so explicit but maybe we are looking for numbers, or words. Guess what, there's a special regular expression for it. Let's start with numbers. But as we've learned before, regular expressions check each character on its own. Well, 400 for example, is a number but it consists of three digits: 4, 0 and 0. That's why the first regular expression pattern we are looking for today, isn't called &lt;code&gt;\n&lt;/code&gt; but &lt;code&gt;\d&lt;/code&gt; – for digit. &lt;/p&gt;

&lt;p&gt;I mentioned the backslash in the first part already but as a reminder: if the regular expression would look like this: &lt;code&gt;/d/&lt;/code&gt; , we would match all &lt;strong&gt;d&lt;/strong&gt;'s in our recipe. But we are looking for digits, so we need the backslash to tell that we gonna use kinda predefined pattern to match all digits. &lt;/p&gt;

&lt;p&gt;A bit less strict is the &lt;strong&gt;word&lt;/strong&gt; character, that looks like this: &lt;code&gt;\w&lt;/code&gt;. Using this pattern, we'd match all alphanumeric characters. So basically all letters, no matter if capital or lowercase and all digits. Also, underscores (&lt;code&gt;_&lt;/code&gt;) will get matched, for example, the URL in our recipe. But no &lt;code&gt;'&lt;/code&gt;, &lt;code&gt;()&lt;/code&gt;, &lt;code&gt;/&lt;/code&gt; or spaces. Actually, spaces are a common task to look out for. They don't belong to digits and although you could write the pattern to match spaces like this: &lt;code&gt;/ /&lt;/code&gt;, it's not very easy to read. Luckily, there's a special character for it: the whitespace character: &lt;code&gt;\s&lt;/code&gt;. Not too difficult, right? For digits, we use &lt;code&gt;\d&lt;/code&gt;, for words &lt;code&gt;\w&lt;/code&gt; and for spaces &lt;code&gt;\s&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;And just when it starts making sense, I'll create a bit of chaos. But don't worry, not for long.&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%2Fi%2Fsw77jqlv3mxgcorjvwm2.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%2Fi%2Fsw77jqlv3mxgcorjvwm2.jpg" alt="Photo by Amador Loureiro on Unsplash" width="800" height="535"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sometimes, we just want to go nuts and match &lt;strong&gt;everything&lt;/strong&gt;. Literally everything. We are hungry. For that, we need a very, very important special character: &lt;code&gt;.&lt;/code&gt;. Yep, it's a dot that will bring us the power to match the whole alphabet soup – and even the spaces in-between. Crazy, isn't it? But what's the chaos I mentioned? Well, there's no backslash. So if you want to literally want to match a dot - and only a dot, you have to escape it with a backslash. So while &lt;code&gt;.&lt;/code&gt; matches everything, &lt;code&gt;\.&lt;/code&gt; will match dots only. &lt;/p&gt;

&lt;h3&gt;
  
  
  BRAIN FOOD
&lt;/h3&gt;

&lt;p&gt;I know, it was a lot to take in. So, let's review all the things we've learned. If you are in the unfortunate situation of not being able to open your editor, have a look at this short video where I apply the patterns we just learned. At first, we catch all digits. After that all words, all spaces and at the end, we use the fantastic but sometimes scary &lt;code&gt;.&lt;/code&gt; character to match everything:&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%2Fi%2Fea6z6m47f5xqavzbxh63.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%2Fi%2Fea6z6m47f5xqavzbxh63.gif" alt="RegEx GIF" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you have seen, when we use &lt;code&gt;\d&lt;/code&gt; to match all digits, we literally match &lt;strong&gt;all&lt;/strong&gt; digits. Same with &lt;code&gt;\w&lt;/code&gt; – we match &lt;strong&gt;all&lt;/strong&gt; word characters. While that is logical and correct, it also might be a bit confusing as it seems the &lt;code&gt;\w&lt;/code&gt; expression matches whole words. That's not the case: &lt;strong&gt;it matches each character on its own&lt;/strong&gt;. One way to make it easier to understand is when we use the hat/caret character: &lt;code&gt;^&lt;/code&gt;. In combination with our digit expression, we'll get the following result:&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%2Fi%2Fn6355552r46ncbjb5r73.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%2Fi%2Fn6355552r46ncbjb5r73.png" alt="Code Example" width="800" height="765"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Have a look at the number 400. We will only match the 4, as that's the digit at the beginning and exactly what we are looking for – for a single digit at the start of a line. You can try the other new expressions in combination with the hat as well: &lt;code&gt;/^\w/&lt;/code&gt;, &lt;code&gt;/^\s/&lt;/code&gt; and even &lt;code&gt;/^./&lt;/code&gt;. See, our expressions start to look cryptic but you are able to read them! That's amazing! We can do more. Guess what the following regular expression might match before you enter it to your editor: &lt;code&gt;/\b\w\b/&lt;/code&gt;. The &lt;code&gt;\b&lt;/code&gt; character was the one for &lt;strong&gt;word boundary&lt;/strong&gt; and we covered it in the &lt;a href="https://www.codegram.com/blog/understanding-regex-once-and-for-all-part-one/" rel="noopener noreferrer"&gt;first part&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;And, did you figure the correct answer?&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Header photo by &lt;a href="https://unsplash.com/@8moments?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Simon Matzinger&lt;/a&gt; on &lt;a href="https://unsplash.com/photos/WwCTFNpZx8g" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>regex</category>
    </item>
    <item>
      <title>Understanding Regular Expressions once and for all [PART 1]</title>
      <dc:creator>Svenja Schäfer</dc:creator>
      <pubDate>Tue, 25 Feb 2020 09:45:22 +0000</pubDate>
      <link>https://dev.to/codegram/understanding-regular-expressions-once-and-for-all-part-1-2g4g</link>
      <guid>https://dev.to/codegram/understanding-regular-expressions-once-and-for-all-part-1-2g4g</guid>
      <description>&lt;p&gt;Originally published at: &lt;a href="https://www.codegram.com/blog/understanding-regex-once-and-for-all-part-one" rel="noopener noreferrer"&gt;Codegram's blog&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Did you ever try to learn &lt;strong&gt;Regular Expressions&lt;/strong&gt; and felt a bit overwhelmed when getting confronted with a bunch of characters? Characters that – in correct order – are able to create any kind of search pattern you were looking for? If so, believe me, you are not alone. And good news: After this series, all the question marks in your head will be gone and you might start using regular expressions asking your friends for their dinner plans. (&lt;em&gt;-&amp;gt; send them a link, so they can answer&lt;/em&gt;)&lt;/p&gt;

&lt;h3&gt;
  
  
  WHAT’S THE FUSS ABOUT
&lt;/h3&gt;

&lt;p&gt;To get an idea of how regular expressions are structured, let’s have a look at a very simple example: Let’s imagine we have the following sentence:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Hummus is a dip made from chickpeas, tahini (optional), lemon, garlic and some more spices.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We want to check, if chickpeas are an ingredient of Hummus, so let’s write our very first regular expression: &lt;code&gt;/chickpea/&lt;/code&gt;. That’s it. That’s a fully working and acceptable regular expression. The important part is, how you’ll read it: &lt;strong&gt;Do not&lt;/strong&gt; read the word itself but each character separated. Start at the very beginning: &lt;br&gt;
&lt;code&gt;/&lt;/code&gt; implies we’ll write a regular expression. Followed by c, by h, an i, c, k, p, e, a and finally another &lt;code&gt;/&lt;/code&gt;, that shows the end of our pattern. Et voilà, we’ll get a match because 'chickpea' consists literally of the regular expression we just wrote. And with that, you know one very important set of regular expressions: literal characters. So whenever you see a character without any other symbol (&lt;code&gt;/, ^, $, …&lt;/code&gt; ), it’s a literal character. The fun starts with the next group though: &lt;strong&gt;the special character group&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  WHEN YOU ENTER A RESTAURANT, TAKE YOUR HAT OFF
&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%2Fi%2Ftmda2y8whtyp6o72vskl.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%2Fi%2Ftmda2y8whtyp6o72vskl.jpg" alt="Photo by Louis Hansel @shotsoflouis on Unsplash" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s imagine, our text not only shows the explanation what Hummus is, but maybe has a whole food list. But we are only interested in Hummus, because it’s so damn yummy. So, we are looking for the very first character(s) of each line. To do so, we’ll use a special character: the hat: &lt;code&gt;^&lt;/code&gt;. Instead of writing &lt;code&gt;/Hummus/&lt;/code&gt;, we’ll add the tiny hat in front of our literal characters: &lt;code&gt;/^Hummus/&lt;/code&gt;. Like this, it doesn’t matter if one of the other foods maybe are made of Hummus, our pattern will only filter the word Hummus at the beginning of a line:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Hummus&lt;/strong&gt; is a dip made from chickpeas, tahini (optional), lemon, garlic and some more spices. | Origin: Middle East &lt;/p&gt;

&lt;p&gt;Falafel is a deep-fried ball (or patty), made from ground chickpeas, herbs, spices and onions and gets served with Hummus. | Origin: Egypt &lt;/p&gt;

&lt;p&gt;Miso soup consists of a stock called “dashi” mixed with miso paste. | Origin: Japan &lt;/p&gt;

&lt;p&gt;Tofu is made by coagulating soy milk and then pressing the resulting curds into blocks of varying softness. | Origin: China&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Pay attention that the Hummus inside the Falafel description doesn’t get matched!&lt;/p&gt;

&lt;h3&gt;
  
  
  BEFORE YOU LEAVE, PAY!
&lt;/h3&gt;

&lt;p&gt;Now that we’ve seen how to catch the beginning of a line, what about the end of one? What, if we want to get all the food from Japan only? We just could write our literal character expression (&lt;code&gt;/Japan/&lt;/code&gt;) but maybe 'Japan' is included in the description part of the list as well. That’s not what we want. Also, if you use the literal character expression, you would get a match for “Japanese” as well. Again, that’s not what we want. We want to find “Japan” at the end of a line. &lt;br&gt;
Coming back to our restaurant situation: we enjoyed a fancy dinner and what do we have to do before leaving? Right, paying the bill. And here comes our next special regular expression character: &lt;code&gt;$&lt;/code&gt; - the dollar sign. While the hat character gets added at the beginning of the expression, the dollar sign gets attached to the end of it like so: &lt;code&gt;/Japan$/&lt;/code&gt;. And with that, you would be able to match Japan in the third row of our example. &lt;/p&gt;

&lt;p&gt;Now that we know how to catch something at the beginning of a line (&lt;code&gt;^&lt;/code&gt;) and at the end of a line (&lt;code&gt;$&lt;/code&gt;), let’s have a look how we can match some pattern in the whole text. I mentioned that with this regular expression &lt;code&gt;/Japan/&lt;/code&gt;, we would find each “Japan” inside our given list. But we would also match 'Japanese' because 'Japan' is part of it. If we just want to search for 'Japan', we need the word boundary character that looks like this: &lt;code&gt;\b&lt;/code&gt;. This special character is different to the previous ones as it consists of two characters: &lt;code&gt;\&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt;. You’ll see the backslash in the next parts more often. It is a special character on its own and in this case it indicates that the following literal character 'b' is a special character, too. Another difference to the hat and dollar character is, that it not only appears once but twice: before and after the word you are trying to find. In our case, if we want to match “Japan” only, our expression could look like this: &lt;code&gt;/\bJapan\b/&lt;/code&gt;. I said it’s gonna be fun, right?&lt;/p&gt;

&lt;h3&gt;
  
  
  COOKING TIME
&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%2Fi%2Fhpkz379vszxlrjylwdg5.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%2Fi%2Fhpkz379vszxlrjylwdg5.jpg" alt="Photo by Calum Lewis on Unsplash" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Reading about regular expressions is one thing, writing a totally different one. So let’s jump to our kitchen and prepare some nice regular expressions. Although there are different tools out there to test regular expressions, we’ll keep it simple and use our favourite editor for now (mine is Visual Studio Code). Create a new file 'hungry-regex.md' and copy the food list from above. Open the search bar (⌘+F) and click this magical sign: &lt;code&gt;.*&lt;/code&gt;. That sign enables searching with regular expressions (&lt;em&gt;&lt;strong&gt;Note&lt;/strong&gt;: you don’t need to add &lt;code&gt;/&lt;/code&gt; at the start and end of your regular expression!&lt;/em&gt;). Now, let’s try out some scenarios:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Write a regular expression to find the characters 'is' inside the whole list.&lt;/li&gt;
&lt;li&gt;Write a regular expression to find the characters 'Miso' at the beginning of a line.&lt;/li&gt;
&lt;li&gt;Write a regular expression to find the characters 'Yemen' at the end of a line.&lt;/li&gt;
&lt;li&gt;Write a regular expression to find the word 'is' inside the whole list.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Well done! Stay tuned for the next part where we'll check out some more special characters like &lt;code&gt;\w, \s, \d,&lt;/code&gt;.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Photo by &lt;a href="https://unsplash.com/@gpthree?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;George Pagan III&lt;/a&gt; on &lt;a href="https://unsplash.com/photos/WwCTFNpZx8g" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>regex</category>
    </item>
  </channel>
</rss>
