Regular expression
-
Hi, I am having below regular expression /[^/]+/(?<Name1>[^/]+)/[^/]+/(?<Name2>.+) which will accept strings of below format /VB/XYZ/8/5/10103303.abc I want to extend my regular expression which will accept extra feild like " ?key=name3 so my input string will /VB/XYZ/8/5/10103303.abc?key=<name3> Please suggest Thanks,
-
Hi, I am having below regular expression /[^/]+/(?<Name1>[^/]+)/[^/]+/(?<Name2>.+) which will accept strings of below format /VB/XYZ/8/5/10103303.abc I want to extend my regular expression which will accept extra feild like " ?key=name3 so my input string will /VB/XYZ/8/5/10103303.abc?key=<name3> Please suggest Thanks,
Just tag it on the end: /[^/]+/(?<Name1>[^/]+)/[^/]+/(?<Name2>.+)\?(?<Key>.*)=(?<Token>.*) I strongly suggest you get a copy of Expresso [^]- it creates, explains, and tests regular expressions. [edit]replaced < and > with safe versions.[/edit]
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
modified on Wednesday, February 17, 2010 5:26 AM
-
Just tag it on the end: /[^/]+/(?<Name1>[^/]+)/[^/]+/(?<Name2>.+)\?(?<Key>.*)=(?<Token>.*) I strongly suggest you get a copy of Expresso [^]- it creates, explains, and tests regular expressions. [edit]replaced < and > with safe versions.[/edit]
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
modified on Wednesday, February 17, 2010 5:26 AM
Hi, Thank you for your reply can you please make it more clear by providing full regular expression and this is a url string which is having querystring "key=" at the ending and I am reading this value using m.Groups["name3"] in my C# application. Thanks,
-
Hi, Thank you for your reply can you please make it more clear by providing full regular expression and this is a url string which is having querystring "key=" at the ending and I am reading this value using m.Groups["name3"] in my C# application. Thanks,
Sorry about that - I have modified the original post. For some reason, the "encode "<" and other HTML characters" option is not working... /[^/]+/(?<Name1>[^/]+)/[^/]+/(?<Name2>.+)\?(?<Key>.*)=(?<Token>.*)
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
-
Sorry about that - I have modified the original post. For some reason, the "encode "<" and other HTML characters" option is not working... /[^/]+/(?<Name1>[^/]+)/[^/]+/(?<Name2>.+)\?(?<Key>.*)=(?<Token>.*)
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
Thank you it is working.