开发者

Need some help with a RegEx query

开发者 https://www.devze.com 2023-04-07 00:18 出处:网络
Given the following strin开发者_如何学Gog: someObject.SomeFunction.parameters[0] = new Thing(\'ValueName\', 0);

Given the following strin开发者_如何学Gog:

someObject.SomeFunction.parameters[0] = new Thing('ValueName', 0);

How to I get just the ValueName value? - using C#


You can use String.Substring method or using regex:

(?<=')(?:\\'|[^'])*(?=')

e.g.:

Regex.Match(input, @"(?<=')(?:\\'|[^'])*(?=')").Value
0

精彩评论

暂无评论...
验证码 换一张
取 消