gpt4 book ai didi

python - 正则表达式 XML 选择提取元素

转载 作者:行者123 更新时间:2023-12-05 09:01:17 27 4
gpt4 key购买 nike

我正在尝试从 BYPASS 0 0 0 开始进行正则表达式选择,直到并包括它显示的部分 WAK 0 0 这是我所拥有的 (?s)(?=BYPASS).*?(WAK....) 我认为我使用 python 的语法不正确,这也是我在 python 脚本中使用它的方式 re.split(r '(?s)(?=BYPASS).*?(WAK....)', r) 我相信这对我造成了问题 (?s) 结果是不正确的正则表达式选择。

<REAPER_PROJECT 0.1 "6.66/win64" 1661879469
<NOTES 0 2
>
RIPPLE 0
GROUPOVERRIDE 0 0 0
AUTOXFADE 129
ENVATTACH 3
POOLEDENVATTACH 0
MIXERUIFLAGS 11 48
PEAKGAIN 1
FEEDBACK 0
PANLAW 1
PROJOFFS 0 0 0
MAXPROJLEN 0 600
GRID 3199 8 1 8 1 0 0 0
TIMEMODE 1 5 -1 30 0 0 -1
VIDEO_CONFIG 0 0 256
PANMODE 3
CURSOR 0
ZOOM 100 0 0
VZOOMEX 6 0
USE_REC_CFG 0
RECMODE 1
SMPTESYNC 0 30 100 40 1000 300 0 0 1 0 0
LOOP 0
LOOPGRAN 0 4
RECORD_PATH "" ""
<RECORD_CFG
ZXZhdxgAAA==
>
<APPLYFX_CFG
>
RENDER_FILE ""
RENDER_PATTERN mask
RENDER_FMT 0 2 44100
RENDER_1X 0
RENDER_RANGE 1 0 0 16 1000
RENDER_RESAMPLE 3 0 1
RENDER_ADDTOPROJ 0
RENDER_STEMS 2048
RENDER_DITHER 0
TIMELOCKMODE 1
TEMPOENVLOCKMODE 1
ITEMMIX 1
DEFPITCHMODE 589824 0
TAKELANE 1
SAMPLERATE 44100 0 0
<RENDER_CFG
ZXZhdyAAAA==
>
LOCK 1
<METRONOME 6 2
VOL 0.25 0.125
FREQ 800 1600 1
BEATLEN 4
SAMPLES "" ""
PATTERN 2863311530 2863311529
MULT 1
>
GLOBAL_AUTO -1
TEMPO 120 4 4
PLAYRATE 1 0 0.25 4
SELECTION 0 0
SELECTION2 0 0
MASTERAUTOMODE 0
MASTERTRACKHEIGHT 0 0
MASTERPEAKCOL 16576
MASTERMUTESOLO 0
MASTERTRACKVIEW 0 0.6667 0.5 0.5 -1 -1 -1 0 0 0 -1 -1 0
MASTERHWOUT 0 0 1 0 0 0 0 -1
MASTER_NCH 2 2
MASTER_VOLUME 1 0 -1 -1 1
MASTER_PANMODE 3
MASTER_FX 1
MASTER_SEL 0
<MASTERPLAYSPEEDENV
EGUID {07BFCFC9-6DA0-4D9C-8821-7D1555F3F3F8}
ACT 0 -1
VIS 0 1 1
LANEHEIGHT 0 0
ARM 0
DEFSHAPE 0 -1 -1
>
<TEMPOENVEX
EGUID {9059CD91-68BB-42A7-8E08-BCDDCB3AC50B}
ACT 0 -1
VIS 1 0 1
LANEHEIGHT 0 0
ARM 0
DEFSHAPE 1 -1 -1
>
<PROJBAY
>
<TRACK {7233B3F7-03A2-4203-B516-704EFF3393E3}
NAME dac
PEAKCOL 16576
BEAT -1
AUTOMODE 0
VOLPAN 1 0 -1 -1 1
MUTESOLO 0 0 0
IPHASE 0
PLAYOFFS 0 1
ISBUS 0 0
BUSCOMP 0 0 0 0 0
SHOWINMIX 1 0.6667 0.5 1 0.5 -1 -1 -1
SEL 0
REC 0 0 1 0 0 0 0 0
VU 2
TRACKHEIGHT 138 0 0 0 0 0
INQ 0 0 0 0.5 100 0 0 100
NCHAN 4
FX 1
TRACKID {7233B3F7-03A2-4203-B516-704EFF3393E3}
PERF 0
MIDIOUT -1
MAINSEND 1 0
<FXCHAIN
WNDRECT 330 364 511 642
SHOW 0
LASTSEL 2
DOCKED 0
BYPASS 0 0 0
<VST "VST: FreeG (Sonalksis)" "Sonalksis FreeG Stereo (64 bit).dll" 0 "" 1181894483<56535446724753667265656700000000> ""
U0dyRu5e7f4CAAAAAQAAAAAAAAACAAAAAAAAAAIAAAABAAAAAAAAAAIAAAAAAAAAPAAAAAEAAAAAABAA
aH5iPgAAAD8AAAAAAAAAAAAAAAAAAAA/AAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAAAAAAAAAAA
AE5vbmUAEAAAAA==
>
PRESETNAME None
FLOATPOS 0 0 0 0
FXID {B7036F0D-9C41-461A-B1F6-CEB9D441E7EF}
WAK 0 0
BYPASS 0 0 0
<VST "VST: FreeG (Sonalksis)" "Sonalksis FreeG Stereo (64 bit).dll" 0 "" 1181894483<56535446724753667265656700000000> ""
U0dyRu5e7f4CAAAAAQAAAAAAAAACAAAAAAAAAAIAAAABAAAAAAAAAAIAAAAAAAAAPAAAAAEAAAAAABAA
uDDmPQAAAD8AAAAAAAAAAAAAAAAAAAA/AAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAAAAAAAAAAA
AE5vbmUAEAAAAA==
>
PRESETNAME None
FLOATPOS 0 0 0 0
FXID {9EEDFB75-3908-406D-BB87-69B4E868EDEA}
WAK 0 0
BYPASS 0 0 0
<VST "VST: FreeG (Sonalksis)" "Sonalksis FreeG Stereo (64 bit).dll" 0 "" 1181894483<56535446724753667265656700000000> ""
U0dyRu5e7f4CAAAAAQAAAAAAAAACAAAAAAAAAAIAAAABAAAAAAAAAAIAAAAAAAAAPAAAAAEAAAAAABAA
I8XFPgAAAD8AAAAAAAAAAAAAAAAAAAA/AAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAAAAAAAAAAA
AE5vbmUAEAAAAA==
>
PRESETNAME None
FLOATPOS 0 0 0 0
FXID {B0417D0E-CEA3-4E1F-9BF3-7D4DCE72AC39}
WAK 0 0
>
<ITEM
POSITION 0
SNAPOFFS 0
LENGTH 14.22222222222222
LOOP 1
ALLTAKES 0
FADEIN 1 0.01 0 1 0 0 0
FADEOUT 1 0.01 0 1 0 0 0
MUTE 0 0
SEL 1
IGUID {D7A853A4-5113-4456-A452-7369A41CBB08}
IID 1
NAME dac.wav
VOLPAN 1 0 1 -1
SOFFS 0
PLAYRATE 1 1 0 -1 0 0.0025
CHANMODE 0
GUID {723895C2-2164-4743-9EAD-77CD9086FD1A}
<SOURCE WAVE
FILE "dac.wav"
>
>
>
>

最佳答案

Here是以下匹配正则表达式的示例:

BYPASS.*?(?:WAK \d \d)

这是在 Python 中实现正则表达式的方式:

import re
matches = re.findall(r'BYPASS.*?(?:WAK \d \d)', string, flags=re.S|re.M)

我必须使用 ?: 摆脱捕获组并将标志设置为参数以使其正常工作,但这应该是您所需要的。

关于python - 正则表达式 XML 选择提取元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73548948/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com