使用php解析
给定一个字符串:
[[Pulsatile_flow|pulsatile]] 血流的本质产生了脉搏 向下传播的波 [[动脉树]],并且在 [[主动脉_分叉|分叉]] 反射波反弹返回 半月瓣和起源 [[主动脉]]。这些返回波产生 这 [[重搏切迹#心室收缩|重搏 主动脉内显示切迹]] [[心脏期间的压力曲线 循环]]当这些反射波推动 在[[心脏瓣膜|主动脉半月形 瓣膜]].[[维基词典:主动脉|]]
我如何提取“[[ ]]”中包含的所有单词/短语,然后使用 php 将其放入数组中。
有条件: 如果“|”存在 只检索“|”之后的单词如果“|”后面没有单词检索“|”之前的单词但在“:”之后。
括号中的单词也将被忽略。
例如
[[aorta]] => retrieve aortal
[[Pulsatile_flow|pulsatile]] => retrieve only pulsatile
[[Pulsatile_flow|pulsatile (temp)]] => retrieve only pulsatile
[[Wiktionary:aorta|Aorta Topic]] => retrieve Aorta Topic
[[Wiktionary:aorta|]] => retrieve aorta
[[aorta|]] => retrieve aorta
如果“|”不存在 检索全部
[[维基词典:主动脉]] =>检索维基词典:主动脉
given a string :
The [[Pulsatile_flow|pulsatile]]
nature of blood flow creates a pulse
wave that is propagated down the
[[arterial tree]], and at
[[Aortic_bifurcation|bifurcations]]
reflected waves rebound to return to
semilunar valves and the origin of the
[[aorta]]. These return waves create
the
[[Dicrotic_notch#Ventricular_systole|dicrotic
notch]] displayed in the aortic
pressure curve during the [[cardiac
cycle]] as these reflected waves push
on the [[heart valve|aortic semilunar
valve]].[[Wiktionary:aorta|]]
how could i extract ALL words/phrases enclosed in '[[ ]]' and put then in an array using php.
with condition :
if "|" exist retrieve only words after "|" if no words exist after "|" retrieve the words before "|" but after ":" .
words in parenthesis will also be disregarded.
example
[[aorta]] => retrieve aortal
[[Pulsatile_flow|pulsatile]] => retrieve only pulsatile
[[Pulsatile_flow|pulsatile (temp)]] => retrieve only pulsatile
[[Wiktionary:aorta|Aorta Topic]] => retrieve Aorta Topic
[[Wiktionary:aorta|]] => retrieve aorta
[[aorta|]] => retrieve aorta
if "|" did not exists retrieve all
[[Wiktionary:aorta]] => retrieve Wiktionary:aorta
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看看这个:
Check this out: