假设我有这个字符串:
For the AWSDataTransfer product, this is the public pricing plan.
Regarding data transfer across EC2 AZs:
In all AWS regions, inbound is $0.01/GB.
In all AWS regions, outbound is $0.01/GB.
我想将其更改为 JSON,如下所示:
{
"Product" : "AWSDataTransfer",
"PlanName" : "public",
"EC2Regional" : [
{"region" : "all", "type" : "in", "rate" : "0.01/GB"},
{"region" : "all", "type" : "out", "rate" : "0.01/GB"}
],
}
我如何使用正则表达式来做到这一点。任何人都可以编写代码并帮助我。