It's pretty simple, but this regular expression will retrieve the queue name, and provide it back as a group. This can use used to retrieve the information, and provide it back in a consistent manner.
string queueUrl = "http://queue.amazonaws.com/A1MU5FWLQSN7CU/SimpleQueue";
var expression = "^http://queue.amazonaws.com/[0-9a-zA-z]+/(?
Regex regEx = new Regex(expression);
Match m = regEx.Match(queueUrl);
if (m.Success)
{
var group = m.Groups["name"];
var found = group.Success;
var value = group.Value;
Console.WriteLine("Found Queue? {0}", found);
Console.WriteLine("Queue Value: {0}", value);
}
No comments:
Post a Comment