<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>开发 - 标签 - Vindrin</title><link>https://vindrin.top/zh-cn/tags/%E5%BC%80%E5%8F%91/</link><description>开发 - 标签 - Vindrin</description><generator>Hugo -- gohugo.io</generator><language>zh-CN</language><managingEditor>vindrin@outlook.com (Vindrin)</managingEditor><webMaster>vindrin@outlook.com (Vindrin)</webMaster><lastBuildDate>Sun, 15 Mar 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://vindrin.top/zh-cn/tags/%E5%BC%80%E5%8F%91/" rel="self" type="application/rss+xml"/><item><title>正则表达式实用指南</title><link>https://vindrin.top/zh-cn/docs/regex-guide/</link><pubDate>Sun, 15 Mar 2026 00:00:00 +0000</pubDate><author>vindrin@outlook.com (Vindrin)</author><guid>https://vindrin.top/zh-cn/docs/regex-guide/</guid><description><![CDATA[<h1 id="正则表达式实用指南">正则表达式实用指南</h1>
<p>一旦你开始&quot;拆分思考&quot;而不是死记模式，正则就通了。</p>
<h2 id="核心语法">核心语法</h2>
<table>
  <thead>
      <tr>
          <th>模式</th>
          <th>含义</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>.</code></td>
          <td>任意字符（不含换行）</td>
      </tr>
      <tr>
          <td><code>*</code></td>
          <td>0 次或多次</td>
      </tr>
      <tr>
          <td><code>+</code></td>
          <td>1 次或多次</td>
      </tr>
      <tr>
          <td><code>?</code></td>
          <td>0 次或 1 次（可选）</td>
      </tr>
      <tr>
          <td><code>^</code></td>
          <td>字符串开头</td>
      </tr>
      <tr>
          <td><code>$</code></td>
          <td>字符串结尾</td>
      </tr>
      <tr>
          <td><code>[abc]</code></td>
          <td>字符类</td>
      </tr>
      <tr>
          <td><code>[^abc]</code></td>
          <td>否定字符类</td>
      </tr>
      <tr>
          <td><code>\d</code></td>
          <td>数字 <code>[0-9]</code></td>
      </tr>
      <tr>
          <td><code>\w</code></td>
          <td>单词字符 <code>[a-zA-Z0-9_]</code></td>
      </tr>
      <tr>
          <td><code>\s</code></td>
          <td>空白字符</td>
      </tr>
  </tbody>
</table>
<h2 id="常用模式">常用模式</h2>
<div class="code-block code-line-numbers open" style="counter-reset: code-block 0">
    <div class="code-header language-">
        <span class="code-title"><i class="arrow fas fa-angle-right" aria-hidden="true"></i></span>
        <span class="ellipses"><i class="fas fa-ellipsis-h" aria-hidden="true"></i></span>
        <span class="copy" title="复制到剪贴板"><i class="far fa-copy" aria-hidden="true"></i></span>
    </div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl"># 邮箱（基础）
</span></span><span class="line"><span class="cl">[\w.+-]+@[\w-]+\.[a-zA-Z]{2,}
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"># URL
</span></span><span class="line"><span class="cl">https?://[\w./-]+
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"># IPv4 地址
</span></span><span class="line"><span class="cl">\b\d{1,3}(\.\d{1,3}){3}\b
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"># 日期 YYYY-MM-DD
</span></span><span class="line"><span class="cl">\d{4}-\d{2}-\d{2}
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"># 十六进制颜色
</span></span><span class="line"><span class="cl">#[0-9a-fA-F]{6}</span></span></code></pre></div></div>
<h2 id="python-示例">Python 示例</h2>
<div class="code-block code-line-numbers open" style="counter-reset: code-block 0">
    <div class="code-header language-python">
        <span class="code-title"><i class="arrow fas fa-angle-right" aria-hidden="true"></i></span>
        <span class="ellipses"><i class="fas fa-ellipsis-h" aria-hidden="true"></i></span>
        <span class="copy" title="复制到剪贴板"><i class="far fa-copy" aria-hidden="true"></i></span>
    </div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">re</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">text</span> <span class="o">=</span> <span class="s2">&#34;联系方式：hello@example.com 或 support@test.org&#34;</span>
</span></span><span class="line"><span class="cl"><span class="n">emails</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">findall</span><span class="p">(</span><span class="sa">r</span><span class="s1">&#39;[\w.+-]+@[\w-]+\.[a-zA-Z]{2,}&#39;</span><span class="p">,</span> <span class="n">text</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">emails</span><span class="p">)</span>  <span class="c1"># [&#39;hello@example.com&#39;, &#39;support@test.org&#39;]</span></span></span></code></pre></div></div>
<h2 id="提示">提示</h2>
<p>用 <a href="https://regex101.com" target="_blank" rel="noopener noreffer ">regex101.com</a>
 在线调试，永远在正式使用前用真实数据测试。</p>]]></description></item><item><title>搞懂 Git Rebase 和 Merge 的区别</title><link>https://vindrin.top/zh-cn/posts/git-rebase-vs-merge/</link><pubDate>Tue, 10 Mar 2026 00:00:00 +0000</pubDate><author>vindrin@outlook.com (Vindrin)</author><guid>https://vindrin.top/zh-cn/posts/git-rebase-vs-merge/</guid><description><![CDATA[<h1 id="搞懂-git-rebase-和-merge-的区别">搞懂 Git Rebase 和 Merge 的区别</h1>
<p>这个问题几乎困扰过每一个开发者，今天来讲清楚。</p>
<h2 id="merge">Merge</h2>
<div class="code-block code-line-numbers open" style="counter-reset: code-block 0">
    <div class="code-header language-bash">
        <span class="code-title"><i class="arrow fas fa-angle-right" aria-hidden="true"></i></span>
        <span class="ellipses"><i class="fas fa-ellipsis-h" aria-hidden="true"></i></span>
        <span class="copy" title="复制到剪贴板"><i class="far fa-copy" aria-hidden="true"></i></span>
    </div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">git checkout main
</span></span><span class="line"><span class="cl">git merge feature-branch</span></span></code></pre></div></div>
<p>会创建一个<strong>合并提交</strong>。历史记录清晰展示了两条分支在某个节点汇合。适合共享分支。</p>
<h2 id="rebase">Rebase</h2>
<div class="code-block code-line-numbers open" style="counter-reset: code-block 0">
    <div class="code-header language-bash">
        <span class="code-title"><i class="arrow fas fa-angle-right" aria-hidden="true"></i></span>
        <span class="ellipses"><i class="fas fa-ellipsis-h" aria-hidden="true"></i></span>
        <span class="copy" title="复制到剪贴板"><i class="far fa-copy" aria-hidden="true"></i></span>
    </div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">git checkout feature-branch
</span></span><span class="line"><span class="cl">git rebase main</span></span></code></pre></div></div>
<p>将你的提交&quot;移植&quot;到 <code>main</code> 最新节点之后。历史记录看起来是<strong>线性的</strong>，就像你是在 main 更新后才开始做功能一样。</p>
<h2 id="什么时候用哪个">什么时候用哪个？</h2>
<table>
  <thead>
      <tr>
          <th>场景</th>
          <th>推荐方式</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>共享分支（main、dev）</td>
          <td><code>merge</code></td>
      </tr>
      <tr>
          <td>个人功能分支</td>
          <td><code>rebase</code></td>
      </tr>
      <tr>
          <td>提 PR 之前整理提交</td>
          <td><code>rebase</code></td>
      </tr>
      <tr>
          <td>PR 合并后</td>
          <td>无所谓</td>
      </tr>
  </tbody>
</table>
<h2 id="黄金原则">黄金原则</h2>
<p><strong>永远不要对别人正在用的分支做 rebase。</strong> 重写共享历史会把所有人搞乱。</p>]]></description></item><item><title>Python 虚拟环境详解</title><link>https://vindrin.top/zh-cn/posts/python-venv-guide/</link><pubDate>Tue, 03 Feb 2026 00:00:00 +0000</pubDate><author>vindrin@outlook.com (Vindrin)</author><guid>https://vindrin.top/zh-cn/posts/python-venv-guide/</guid><description><![CDATA[<h1 id="python-虚拟环境详解">Python 虚拟环境详解</h1>
<p>如果你曾经因为全局升级某个包把项目搞崩了，那你就需要虚拟环境了。</p>
<h2 id="什么是虚拟环境">什么是虚拟环境？</h2>
<p>虚拟环境是一个隔离的 Python 安装——它有自己独立的 <code>pip</code> 和包，完全和系统 Python 分开。</p>
<h2 id="创建虚拟环境">创建虚拟环境</h2>
<div class="code-block code-line-numbers open" style="counter-reset: code-block 0">
    <div class="code-header language-bash">
        <span class="code-title"><i class="arrow fas fa-angle-right" aria-hidden="true"></i></span>
        <span class="ellipses"><i class="fas fa-ellipsis-h" aria-hidden="true"></i></span>
        <span class="copy" title="复制到剪贴板"><i class="far fa-copy" aria-hidden="true"></i></span>
    </div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">python -m venv .venv
</span></span><span class="line"><span class="cl"><span class="nb">source</span> .venv/bin/activate    <span class="c1"># Linux/macOS</span>
</span></span><span class="line"><span class="cl">.venv<span class="se">\S</span>cripts<span class="se">\a</span>ctivate       <span class="c1"># Windows</span></span></span></code></pre></div></div>
<h2 id="安装包">安装包</h2>
<div class="code-block code-line-numbers open" style="counter-reset: code-block 0">
    <div class="code-header language-bash">
        <span class="code-title"><i class="arrow fas fa-angle-right" aria-hidden="true"></i></span>
        <span class="ellipses"><i class="fas fa-ellipsis-h" aria-hidden="true"></i></span>
        <span class="copy" title="复制到剪贴板"><i class="far fa-copy" aria-hidden="true"></i></span>
    </div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">pip install requests numpy pandas
</span></span><span class="line"><span class="cl">pip freeze &gt; requirements.txt</span></span></code></pre></div></div>
<h2 id="在别处恢复">在别处恢复</h2>
<div class="code-block code-line-numbers open" style="counter-reset: code-block 0">
    <div class="code-header language-bash">
        <span class="code-title"><i class="arrow fas fa-angle-right" aria-hidden="true"></i></span>
        <span class="ellipses"><i class="fas fa-ellipsis-h" aria-hidden="true"></i></span>
        <span class="copy" title="复制到剪贴板"><i class="far fa-copy" aria-hidden="true"></i></span>
    </div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">python -m venv .venv
</span></span><span class="line"><span class="cl">pip install -r requirements.txt</span></span></code></pre></div></div>
<h2 id="配合-conda-使用">配合 conda 使用</h2>
<p>如果你用 conda，<code>conda create -n myenv python=3.11</code> 也是同样的隔离效果。</p>]]></description></item></channel></rss>