<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Regular Expressions on 六二三&#39;s Blog</title>
    <link>http://sconts.com/legacy/tags/regular-expressions/</link>
    <description>Recent content in Regular Expressions on 六二三&#39;s Blog</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Tue, 18 May 2021 00:00:00 +0000</lastBuildDate><atom:link href="http://sconts.com/legacy/tags/regular-expressions/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Split string with multiple delimiters in Python</title>
      <link>http://sconts.com/legacy/post/split-string-with-multiple-delimiters-in-python/</link>
      <pubDate>Tue, 18 May 2021 00:00:00 +0000</pubDate>
      
      <guid>http://sconts.com/legacy/post/split-string-with-multiple-delimiters-in-python/</guid>
      <description>&lt;p&gt;Python string &lt;code&gt;split()&lt;/code&gt; method allows a string to be easily split into a list based on a delimiter. Though in some cases, you might need the separation to occur based on not just one but multiple delimiter values. This quick 101 article introduces two convenient approaches this can be achieved in Python.&lt;/p&gt;
&lt;h2 id=&#34;split-string-with-two-delimiters-in-python&#34;&gt;Split String With Two Delimiters in Python&lt;/h2&gt;
&lt;p&gt;Assume the following string.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-Python&#34; data-lang=&#34;Python&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;ln&#34; id=&#34;line--1&#34;&gt;&lt;a class=&#34;lnlinks&#34; href=&#34;#line--1&#34;&gt;1&lt;/a&gt;&lt;/span&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;text&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;python is, an easy;language; to, learn.&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For our example, we need to split it either by a semicolon followed by a space &lt;code&gt;;&lt;/code&gt;, or by a comma followed by a space &lt;code&gt;,&lt;/code&gt;. In this case, any occurrences of singular semicolons or commas i.e. &lt;code&gt;,&lt;/code&gt; , &lt;code&gt;;&lt;/code&gt; with no trailing spaces should not be concerned.&lt;/p&gt;&lt;br /&gt;: http://sconts.com/legacy/post/split-string-with-multiple-delimiters-in-python/</description>
    </item>
    
  </channel>
</rss>
