<?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: Jack Schliewe</title>
    <description>The latest articles on DEV Community by Jack Schliewe (@thecandylane).</description>
    <link>https://dev.to/thecandylane</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%2F1016334%2Fd4abf608-bfec-4517-8a90-b4e72968babf.jpeg</url>
      <title>DEV Community: Jack Schliewe</title>
      <link>https://dev.to/thecandylane</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/thecandylane"/>
    <language>en</language>
    <item>
      <title>How to get started with "Regular Expressions" in Python</title>
      <dc:creator>Jack Schliewe</dc:creator>
      <pubDate>Tue, 14 Mar 2023 02:38:10 +0000</pubDate>
      <link>https://dev.to/thecandylane/how-to-get-started-with-regular-expressions-in-python-30k0</link>
      <guid>https://dev.to/thecandylane/how-to-get-started-with-regular-expressions-in-python-30k0</guid>
      <description>&lt;p&gt;Regular expressions (often abbreviated as "regex" or "re") are a powerful tool for working with text in Python. Whether you're parsing text files, searching for specific patterns, or validating user input, regular expressions can help you save time and reduce errors. In this blog post, we'll cover the basics of how to use re in Python.&lt;/p&gt;

&lt;p&gt;What is a Regular Expression?&lt;/p&gt;

&lt;p&gt;At its simplest, a regular expression is a pattern that matches a specific sequence of characters in a string. For example, the regular expression "cat" matches any string that contains the letters "c", "a", and "t" in that order. Regular expressions can be used to match more complex patterns as well, such as email addresses, phone numbers, or URLs.&lt;/p&gt;

&lt;p&gt;Using re in Python&lt;/p&gt;

&lt;p&gt;Python provides a built-in module called "re" for working with regular expressions. The re module provides a variety of functions for working with regular expressions, including:&lt;/p&gt;

&lt;p&gt;re.search(): Searches a string for a match to a regular expression and returns the first match.&lt;br&gt;
re.findall(): Searches a string for all matches to a regular expression and returns a list of all matches.&lt;br&gt;
re.sub(): Searches a string for matches to a regular expression and replaces them with a specified string.&lt;br&gt;
Let's take a look at each of these functions in more detail.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;re.search()&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The re.search() function searches a string for a match to a regular expression and returns the first match. Here's an example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cKeor2F3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hlaklglxm6ezbk5jp41d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cKeor2F3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hlaklglxm6ezbk5jp41d.png" alt="re.search()" width="679" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this example, we import the re module and define a string called "text". We then use the re.search() function to search for the regular expression "fox" in the text string. The function returns a match object if a match is found, which we can then check for using an if statement.&lt;/p&gt;

&lt;p&gt;Note that the regular expression is defined using the "r" prefix, which tells Python to treat the string as a raw string literal. This is important because regular expressions often contain special characters that have special meanings in Python, such as backslashes and quotation marks.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;re.findall()&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The re.findall() function searches a string for all matches to a regular expression and returns a list of all matches. Here's an example:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mDklsvk9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f0iuha97aaeq39slq0ow.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mDklsvk9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f0iuha97aaeq39slq0ow.png" alt="re.findall()" width="880" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here we use the re.findall() function to search for all words in the text string. The regular expression "\w+" matches any sequence of one or more word characters, which includes letters, digits, and underscores. The function returns a list of all matches, which we then print to the console.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;re.sub()&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The re.sub() function searches a string for matches to a regular expression and replaces them with a specified string. Here's an example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HjcOnWyX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p0hg13b73xx1z4eyj6ho.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HjcOnWyX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p0hg13b73xx1z4eyj6ho.png" alt="re.sub()" width="679" height="374"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Similar to the re.findall() example, we use the re.sub() function to replace all occurrences of "fox" in the text string with "cat". The function returns a new string with the replacements made, which we then print to the console.&lt;/p&gt;




&lt;p&gt;Regular Expression Syntax&lt;/p&gt;

&lt;p&gt;Regular expressions can be quite complex, and there are many resources available online for learning more about regular expression syntax. However, here are a few basic patterns that you might find useful:&lt;/p&gt;

&lt;p&gt;. : Matches any single character except newline.&lt;br&gt;
\d : Matches any digit character (equivalent to [0-9]).&lt;br&gt;
\w : Matches any word character (equivalent to [a-zA-Z0-9_]).&lt;br&gt;
\s : Matches any whitespace character (equivalent to [\t\n\r\f\v]).&lt;br&gt;
 : Matches any character inside the brackets. For example, [abc] matches "a", "b", or "c".&lt;br&gt;
[^ ] : Matches any character not inside the brackets. For example, [^abc] matches any character that is not "a", "b", or "c".&lt;br&gt;
: Matches zero or more occurrences of the preceding character or group.&lt;br&gt;
: Matches one or more occurrences of the preceding character or group.&lt;br&gt;
? : Matches zero or one occurrences of the preceding character or group.&lt;br&gt;
{m} : Matches exactly m occurrences of the preceding character or group.&lt;br&gt;
{m,n} : Matches between m and n occurrences of the preceding character or group.&lt;br&gt;
and These are just a few of the many regular expression syntax patterns available. Although this seems like a lot, there's so many more helpful places you can implement &lt;em&gt;re&lt;/em&gt; in your code, so &lt;a href="https://docs.python.org/3/howto/regex.html"&gt;check out pythons documentation to get the full rundown.&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>"The Hidden Dangers of Online Connectivity and How to Avoid Them"</title>
      <dc:creator>Jack Schliewe</dc:creator>
      <pubDate>Thu, 16 Feb 2023 15:07:27 +0000</pubDate>
      <link>https://dev.to/thecandylane/the-hidden-dangers-of-online-connectivity-and-how-to-avoid-them-eo8</link>
      <guid>https://dev.to/thecandylane/the-hidden-dangers-of-online-connectivity-and-how-to-avoid-them-eo8</guid>
      <description>&lt;p&gt;In the age of the internet and digitalization, smartphones and computers have become an integral part of our daily lives. However, with increasing connectivity, we have become more vulnerable to cyber-attacks and digital threats. These threats can range from viruses and malware to identity theft and data breaches. In this blog post, we will explore some of the vulnerabilities of our smartphones and computers and some ways to prevent them.&lt;/p&gt;

&lt;p&gt;One of the biggest vulnerabilities of our smartphones and computers is their susceptibility to viruses and malware. These malicious programs can be easily downloaded onto our devices, often without our knowledge, and can cause significant harm to our systems. Once downloaded, viruses and malware can steal our personal information, lock us out of our own devices, or even render our devices completely unusable.&lt;/p&gt;

&lt;p&gt;To prevent these threats, it is essential to install reputable antivirus and anti-malware software on our devices. These programs will scan our devices regularly for any threats and alert us if anything suspicious is detected. It is also important to keep our devices' operating systems and software up-to-date, as updates often contain security patches that protect against known vulnerabilities.&lt;/p&gt;

&lt;p&gt;Another vulnerability of our smartphones and computers is our own behavior when using them. We often unknowingly engage in risky behavior, such as downloading files from untrusted sources or clicking on suspicious links. These actions can result in the installation of malware and viruses onto our devices, putting our personal information at risk.&lt;/p&gt;

&lt;p&gt;To prevent these threats, it is important to practice safe browsing habits. This includes avoiding clicking on suspicious links, only downloading files from trusted sources, and being cautious of emails and messages from unknown senders. It is also important to use strong and unique passwords for all of our accounts, and to enable two-factor authentication whenever possible.&lt;/p&gt;

&lt;p&gt;A third vulnerability of our smartphones and computers is our reliance on public Wi-Fi networks. Public Wi-Fi networks are often unsecured, meaning that anyone can potentially access the data being transmitted over the network. This puts our personal information at risk, as hackers can intercept our data and steal our sensitive information.&lt;/p&gt;

&lt;p&gt;To prevent these threats, it is important to avoid using public Wi-Fi networks whenever possible. If we must use public Wi-Fi, it is important to use a virtual private network (VPN) to encrypt our data and protect our information from potential hackers. It is also important to avoid accessing sensitive information, such as online banking or shopping, while using public Wi-Fi networks.&lt;/p&gt;

&lt;p&gt;It is also important to realize that our actions on the internet leave a permanent digital footprint, and that everything we see and read online should be taken with a grain of salt. Everything on the internet was made by a person with a goal in mind, and those goals may not always align with the best interests of others. For example, apps and websites may be designed to be addictive or manipulate our behavior in ways we may not be aware of. It is important to be mindful of our online behavior and to be critical of the information we consume, as well as the platforms and services we use. By being aware of these issues and taking proactive steps to protect ourselves, we can navigate the digital landscape with greater safety and security.&lt;/p&gt;

&lt;p&gt;In conclusion, our smartphones and computers are vulnerable to a wide range of digital threats. To protect our devices and personal information, it is essential to practice safe browsing habits, install reputable antivirus and anti-malware software, and avoid using public Wi-Fi networks whenever possible. By taking these precautions, we can enjoy the benefits of our digital devices without putting ourselves at unnecessary risk.&lt;/p&gt;

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