2

我有一个 Drupal 模块以这种方式替换文本:

Text to find:
Replace with:

我只需要留下 mp3 的 URL。我想是这样的:

Text to find: (previous text) (mp3 url) (subsequent text)
Replace with: /2

我为 mp3 的 URL 找到了这个:

(((http://www)|(http://)|(www))[-a-zA-Z0-9@:%_\+.~#?&//=]+)\.(mp3|MP3)

但我不知道用什么来匹配前后的整个文本。

(模块是“Feeds Tamper”)

4

1 回答 1

1

您的 mp3 正则表达式有点太复杂了。

/(http://)?(www)?[-a-zA-Z0-9@:%_\+.~#?\/=]+\.mp3/i

更容易和更短。

要匹配之前和之后的一些文本,您可以使用.*. 那匹配everything 0 or more times

于 2013-10-27T09:45:02.990 回答