正则表达式与 wxwidgets
Regex with wxwdigets
我正在使用 Google 翻译 API 显然我想解析翻译的文本。为此,我使用了 wxWidget.
中包含的正则表达式 class
这是我的代码和示例文本:
wxRegEx responseText = "\"translatedText\": \"(.*)\"";
wxString text = responseText.GetMatch("{\n \"data\": {\n \"translations\": [\n {\n \"translatedText\": \"Hello how are you?\"\n }\n ]\n }\n}\n");
但是没用。有什么建议吗?谢谢!
转义转义字符 \
使它们像转义字符一样工作。使用以下
wxRegEx responseText = "\"translatedText\": \"(.*)\""
作为example in the documentation shows, you must call Matches() before using GetMatch()(后者本身的文档中也强调了这一点!)。
我正在使用 Google 翻译 API 显然我想解析翻译的文本。为此,我使用了 wxWidget.
中包含的正则表达式 class这是我的代码和示例文本:
wxRegEx responseText = "\"translatedText\": \"(.*)\"";
wxString text = responseText.GetMatch("{\n \"data\": {\n \"translations\": [\n {\n \"translatedText\": \"Hello how are you?\"\n }\n ]\n }\n}\n");
但是没用。有什么建议吗?谢谢!
转义转义字符 \
使它们像转义字符一样工作。使用以下
wxRegEx responseText = "\"translatedText\": \"(.*)\""
作为example in the documentation shows, you must call Matches() before using GetMatch()(后者本身的文档中也强调了这一点!)。