通过正则表达式产生价值 [英] Generate value from Regular Expression

查看:98
本文介绍了通过正则表达式产生价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


如何从正则表达式生成字符串? RedGate能够做到这一点,所以我知道这是可能的,只是不确定如何做到.

基本上我希望能够提供

\ w {10}

我会得到一个10个字符串的字符串



\ d {13}

并返回一个13位数字的字符串.

在此先感谢

Hi
How do I generate a string from a regular expression? RedGate are able to do this so I know it''s posible just not sure how.

Basically I want to be able to provide

\w{10}

and I will get a 10 character string back

or

\d{13}

and get a 13 digit string back.

Thanks in advance

推荐答案

Regex.Matches方法?

更新:这不是正确的要求.考虑您有一个正则表达式"\ w".现在,有超过一百万个与该表达式匹配的字符串.如果不是整个字符串,则部分字符串将会出现.
Regex.Matches method?

Update: This is not a correct requirement. Consider you have a regular expression "\w". Now there are more than a million number of strings that match to this expression. If not the entire string, then parts of it will.


这篇关于通过正则表达式产生价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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