【问题标题】:matching random sentences within quotes with regular expression for sublime text使用正则表达式匹配引号内的随机句子以获取崇高文本
【发布时间】:2014-09-12 10:00:04
【问题描述】:

我有一个 3000 行长的 po 文件,我需要基本上交换两种线型,如下所示。我想将包含 msgid 的字符串剪切到剪贴板中,然后将它们粘贴到 msgstr 下面一行以交换它们的位置。

   msgid "Detalles del aporte"
msgstr "Contribution details"

#: controller/admin.php:66
msgid "Cambiando el estado al aporte"
msgstr "Contribution details"

#: controller/admin.php:67
msgid "Aporte manual"
msgstr "Manual contribution"

#: controller/admin.php:68
msgid "Reubicando el aporte"
msgstr "Relocating the contribution"

#: controller/admin.php:69
msgid "Ejecución del cargo"
msgstr "Realisation of charge"

到目前为止,我已经有了以下表达式

(m(sgid\s)([A-Za-z,;'"\\s])$")

但是在此之后我无法继续进行,我该如何匹配其余的文本?

【问题讨论】:

  • 你的预期输出是什么?
  • 它应该选择所有以msgid开头的行

标签: regex sublimetext3


【解决方案1】:

我想你想要这样的东西,

^\s*msgid\s*"(.*?)"$

DEMO

这将捕获仅在包含字符串msgid 的行上出现在双引号内的字符

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-24
    • 1970-01-01
    • 1970-01-01
    • 2022-11-12
    • 2016-08-07
    • 2013-10-27
    相关资源
    最近更新 更多