第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

用于匹配括號(hào)之間數(shù)據(jù)但具有內(nèi)部匹配模式的正則表達(dá)式

用于匹配括號(hào)之間數(shù)據(jù)但具有內(nèi)部匹配模式的正則表達(dá)式

qq_遁去的一_1 2023-11-09 21:28:50
我看到了很多關(guān)于如何使用 python 的正則表達(dá)式在括號(hào)之間獲取數(shù)據(jù)的示例,但沒(méi)有一個(gè)內(nèi)部包含某種模式。例如,我有這樣的數(shù)據(jù):Overall (each): 37 1/4 × 74 1/2 × 7 7/8 in. (94.6 × 189.2 × 20 dm)Each, 30 x 50 in. (76.2 x 127 dm.)24 3/8 x 14 5/8 x 5 1/8 in. (61.9 x 37.1 x 13 dm)我試圖至少實(shí)現(xiàn)的是:(94.6 × 189.2 × 20 dm)(76.2 x 127 dm.)(61.9 x 37.1 x 13 dm)完美的結(jié)果如下所示,但我確信這需要第二次分割:94.6, 189.2, 20 76.2, 12761.9, 37.1, 13目前,我正在嘗試這段代碼:regex,但是正如您所看到的,沒(méi)有成功捕獲 cm 括號(hào)數(shù)據(jù)。
查看完整描述

1 回答

?
慕運(yùn)維8079593

TA貢獻(xiàn)1876條經(jīng)驗(yàn) 獲得超5個(gè)贊

使用

\(([^()]*\bcm\b[^()]*)\)

查看證明

解釋

--------------------------------------------------------------------------------

  \(                       '('

--------------------------------------------------------------------------------

  (                        group and capture to \1:

--------------------------------------------------------------------------------

    [^()]*                   any character except: '(', ')' (0 or

                             more times (matching the most amount

                             possible))

--------------------------------------------------------------------------------

    \b                       the boundary between a word char (\w)

                             and something that is not a word char

--------------------------------------------------------------------------------

    cm                       'cm'

--------------------------------------------------------------------------------

    \b                       the boundary between a word char (\w)

                             and something that is not a word char

--------------------------------------------------------------------------------

    [^()]*                   any character except: '(', ')' (0 or

                             more times (matching the most amount

                             possible))

--------------------------------------------------------------------------------

  )                        end of \1

--------------------------------------------------------------------------------

  \)                       ')'


查看完整回答
反對(duì) 回復(fù) 2023-11-09
  • 1 回答
  • 0 關(guān)注
  • 182 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)