【发布时间】:2018-06-12 11:13:53
【问题描述】:
resource "aws_instance" "launch-ec2-servers"
{
ami = "${var.ec2_ami}"
instance_type = "${var.instance_type}"
key_name = "${var.key_name}"
vpc_security_group_ids = ["${var.security_group}"]
subnet_id = "${var.subnet_id}"
count= "${var.count}"
root_block_device
{
volume_size = "${var.root_volume_size}"
volume_type = "${var.root_volume_type}"
}
ebs_block_device
{
device_name = "${var.ebs_device_name}"
snapshot_id = "${var.ebs_snapshot_id}"
volume_type = "${var.ebs_volume_type}"
}
tags
{
Name = "${var.app_name}"
}
}
嘿,
我正在尝试使用 C#/PowerShell/ASP.Net 中的正则表达式获取 ebs_block_device 块部分。
到目前为止,我尝试将此作为我的正则表达式: (ebs_block_device)(?s)(.[^}]+.)
代码中我感兴趣的块部分是:
ebs_block_device
{
device_name = "${var.ebs_device_name}"
snapshot_id = "${var.ebs_snapshot_id}"
volume_type = "${var.ebs_volume_type}"
}
你能帮我正确地抓住大括号之间的那段文字吗?
【问题讨论】:
-
为什么不将其解析为 JSON 呢? stackoverflow.com/questions/6620165/how-can-i-parse-json-with-c
标签: c# asp.net regex powershell