我正在尝试创建一个正则表达式,以从该字符串中提取第一个 }
和最后一个之间的字符串:
@base64Binary3http://schemas.microsoft.com/2003/10/Serialization/��{"topic":"/subscriptions/xx/resourceGroups/usap-devgru-BBB-interfaces-resgrp/providers/Microsoft.Storage/storageAccounts/BBBdgdevstor","subject":"/blobServices/default/containers/coloradoAAAready/blobs/SIU-S13_2019-5-29 16.26.11_27319.HL7","eventType":"Microsoft.Storage.BlobCreated","eventTime":"2019-06-20T17:10:20.5025763Z",“id”:“ab0f7xxxxxxxxx08b-278fa906f76d”,"data":{"api":"PutBlockList","clientRequestId":"xxxx6-92a6-7a87xx2be32b","requestId":"xxxxx0000","eTag":"0xxxxxD2AEC9",“contentType”:“应用程序/八进制流”,"contentLength":1368,“url”:“BlockBlob”,“blobType”:“https://BBBdgdevstor.blob.core.windows.net/coloradoAAAready/SIU-S13_2019-5-29 16.26.11_27319.HL7",url "dataVersion":"","metadataVersion":"1"}
生成的字符串将为:
如何选择从第一个'{‘到最后一个'}’的文本?
发布于 2019-06-21 03:30:39
这个正则表达式不会为您做这件事吗?
{.*}
默认情况下,Regex天生贪婪,因此它会搜索满足条件的最大匹配项,这听起来就是您想要的。
https://stackoverflow.com/questions/56692366
复制相似问题