我在正则表达式方面很糟糕,非常感谢任何关于这个问题的帮助,我认为这对于任何熟悉的人来说都是新东西。
我从 REST 调用中得到这样的响应
{"responseData":{"translatedText":"Ciao mondo"},"responseDetails":"","responseStatus":200,"matches":[{"id":"424913311","segment":"Hello World","translation":"Ciao mondo","quality":"74","reference":"","usage-count":50,"subject":"All","created-by":"","last-updated-by":null,"create-date":"2011-12-29 19:14:22","last-update-date":"2011-12-29 19:14:22","match":1},{"id":"0","segment":"Hello World","translation":"Ciao a tutti","quality":"70","reference":"Machine Translation provided by Google, Microsoft, Worldlingo or the MyMemory customized engine.","usage-count":1,"subject":"All","created-by":"MT!","last-updated-by":null,"create-date":"2012-05-14","last-update-date":"2012-05-14","match":0.85}]}
我所需要的只是这些引文之间的“Ciao mondo”。我希望使用 Java 的拆分功能可以做到这一点,但不幸的是它不允许两个单独的分隔符,因为我可以在翻译之前指定文本。
为简化起见,我坚持使用正则表达式来收集 translateText":" 和下一个 "
我会非常感谢任何帮助