开发者

Simle regex question, c#

开发者 https://www.devze.com 2023-02-09 16:49 出处:网络
I would like to know how to get only the numbers and the _ from \"{\\\"id\\\":\\\"21432413214_124533451397\\\"}\" using regular e开发者_JS百科xpressions in c#. Here for example, I want the \"214324132

I would like to know how to get only the numbers and the _ from "{\"id\":\"21432413214_124533451397\"}" using regular e开发者_JS百科xpressions in c#. Here for example, I want the "21432413214_124533451397"-part. Thanks!


It looks like you're trying to parse JSON. You can use the c# built in JSON deserializing utilities, if you're parsing a more complex object than what you've described above:

http://msdn.microsoft.com/en-us/library/bb412179.aspx


[0-9]+_[0-9]+ matches two numbers with an underscore between them.


The following should work:

@"""\d+_\d+"""
0

精彩评论

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