<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>regex on Deep Blue</title>
    <link>https://blog.dustbreak.com/tags/regex/</link>
    <description>Recent content in regex on Deep Blue</description>
    <generator>Hugo -- gohugo.io</generator>
    <lastBuildDate>Mon, 13 Sep 2021 21:23:51 +0800</lastBuildDate><atom:link href="https://blog.dustbreak.com/tags/regex/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Regular Expression</title>
      <link>https://blog.dustbreak.com/posts/regex/</link>
      <pubDate>Mon, 13 Sep 2021 21:23:51 +0800</pubDate>
      
      <guid>https://blog.dustbreak.com/posts/regex/</guid>
      <description>1. Search by specific head and end, but don&amp;rsquo;t include them import re reg = &amp;#39;(?&amp;lt;=CN=)[A-Za-z-]*(?=,)&amp;#39; s = &amp;#34;CN=Okta-PagerDuty-RG,OU=Okta Applications,OU=Security Groups,OU=RG New,DC=win,DC=int,DC=rg,DC=com,DC=au&amp;#34; re.search(reg, s).group() # it will return &amp;#39;Okta-PagerDuty-RG&amp;#39; </description>
      <content:encoded><![CDATA[<h2 id="1-search-by-specific-head-and-end-but-dont-include-them">1. Search by specific head and end, but don&rsquo;t include them</h2>
<pre tabindex="0"><code>import re
reg = &#39;(?&lt;=CN=)[A-Za-z-]*(?=,)&#39;
s = &#34;CN=Okta-PagerDuty-RG,OU=Okta Applications,OU=Security Groups,OU=RG New,DC=win,DC=int,DC=rg,DC=com,DC=au&#34;

re.search(reg, s).group()

# it will return &#39;Okta-PagerDuty-RG&#39;
</code></pre>]]></content:encoded>
    </item>
    
  </channel>
</rss>
