特定格式的正则表达式... [英] Regex for the specific format...
问题描述
hi,
我想要一个以下字符串格式的正则表达式。
11-03-2009 23.13.56我的每日活动名称[活动详情]
这里,11-03-2009 - >前10个字符将是上述格式的日期
23.13.56 - >前8个字符将是上述格式的时间
我的每日活动名称 - >这将是事件的名称... chracters限制是20.它是一个字母数字文本。
[事件详细信息] - >这将是事件的细节... chracters限制是100.它是一个字母数字文本。
任何人都可以帮我这个做一个RegEx ... ?
任何文件/链接对我都有帮助。
谢谢,
IamHuM
i want a Regex expression for the following string format.
11-03-2009 23.13.56 My Daily Event Name [Event Details]
here, 11-03-2009 -> first 10 characters will be date in the above format
23.13.56 -> first 8 characters will be time in the above format
My Daily Event Name -> This will be the name of event... chracters limit is 20. And its a Alphanumeric text.
[Event Details] -> This will be the details of event... chracters limit is 100. And its a Alphanumeric text.
Can anybody help me with this to make a RegEx...?
ANy documents/link for the same will be helpful for me.
Thanks,
IamHuM
推荐答案
我有一些但可能是个坏主意。
请试试。前三个我有regx。我不知道最后一个。
字符串值= @" 11-03-2009 23.13.56我的每日活动名称[活动详情]" ;;
字符串日期=正则表达式.Match(value," [A-Za-z0-9 _-] {10}")。Groups [0] .Value;
string time = Regex.Match(value," [A-Za -z0-9 _。] {8}")。Groups [0] .Value
string eventName = Regex.Match(value," [A-Za-z] {20}")。Groups [ 0] .Value
string eventDetails = value.SubString(28,value.Length-29);
Hi,
I got some but may be bad idea.
please try. i have got regx for the first three. i have no idea about the last one.
string value=@"11-03-2009 23.13.56 My Daily Event Name [Event Details]";
string date=Regex.Match(value, "[A-Za-z0-9_-]{10}").Groups[0].Value;
string time=Regex.Match(value, "[A-Za-z0-9_.]{8}").Groups[0].Value
string eventName=Regex.Match(value, "[A-Za-z ]{20}").Groups[0].Value
string eventDetails =value.SubString(28,value.Length-29);
这篇关于特定格式的正则表达式...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!