找到标签及其价值 [英] Finding Tag and it's value

查看:125
本文介绍了找到标签及其价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

示例:
{tag} value {tag}值

需要获取标记及其关联值。我可以用这个正则表达式获得标签:

\ {([A-Za-z0-9] +)\}

但我无法弄清楚如何得到价值。

任何帮助表示

Example:
{tag}value{tag}value

Need to get the tag and its associated value. I can get the tag with this regex:

\{([A-Za-z0-9]+)\}

But I cannot figure out how to get the value.

Any help appreciated

推荐答案

请试试这个¥b $ b
please try this
      string s = "{tag}value{tag}value";
      Regex r = new Regex(@"\}(.+)\{");
      string a = r.Match(s).Groups[1].Value;


这篇关于找到标签及其价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆