擅长:python、mysql、java
<p>Pandas方式,使用<a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.str.findall.html" rel="nofollow noreferrer">^{<cd1>}</a>和<a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.str.html" rel="nofollow noreferrer">^{<cd2>}</a>:</p>
<pre><code>pat=r'(?=({}))'.format('|'.join(re.escape(x) for x in lst))# @thanks Amadan
#'(?=(\\-ae\\-|\\-ap\\-|\\-vn\\-|\\-au\\-|\\-aw\\-|\\-be\\-|\\-bp\\-|\\-br\\-|\\-dz\\-))'
df['CN'].str.findall(pat).str[-1]
</code></pre>
<hr/>
^{pr2}$