尝试使用Scala解析器组合器解析以下字符串
--batch_36522ad7-fc75-4b56-8c71-56071383e77b
Content-Type: application/http
Some stuff in here
--batch_36522ad7-fc75-4b56-8c71-56071383e77b
Content-Type: multipart/mixed;boundary=changeset_77162fcd-b8da-41ac-a9f8-9357efbbd
Some other stuff here
想要了解以下内容:
组别1
--batch_36522ad7-fc75-4b56-8c71-56071383e77b
Content-Type: application/http
Some stuff in here
组2
--batch_36522ad7-fc75-4b56-8c71-56071383e77b
Content-Type: multipart/mixed;boundary=changeset_77162fcd-b8da-41ac-a9f8-9357efbbd
Some other stuff here
我使用repsep编写了以下内容,但在同一输入上运行时遇到错误。
def getListOfRequests: Parser[List[String]] = repsep(getBatchModules, newLineSeparator)
def getBatchModules: Parser[String] = """(?s)--batch_.+?(?=--batch.*)""".r
错误是:
失败:字符串匹配正则表达式
\z' expected but
- '结果- batch_36522ad7-fc75-4b56-8c71-56071383e77b
^
请帮我弄清楚我做错了什么。感谢
答案 0 :(得分:1)