System.Text.RegularExpressions.Regex.Matches C# (CSharp) Method

Matches() public method

public Matches ( string input ) : System.Text.RegularExpressions.MatchCollection
input string
return System.Text.RegularExpressions.MatchCollection
        public System.Text.RegularExpressions.MatchCollection Matches(string input)
        {
            throw null;
        }

Same methods

Regex::Matches ( string input, int startat ) : System.Text.RegularExpressions.MatchCollection
Regex::Matches ( string input, string pattern ) : System.Text.RegularExpressions.MatchCollection
Regex::Matches ( string input, string pattern, System options ) : System.Text.RegularExpressions.MatchCollection
Regex::Matches ( string input, string pattern, System options, System matchTimeout ) : System.Text.RegularExpressions.MatchCollection

Usage Example

Ejemplo n.º 1
2
		public static string UpdateStatus(string status, TwUser user, string replyId)
		{
			Regex regex = new Regex(@"\[(.*?)\]");
			List<FileInfo> media = new List<FileInfo>();
			foreach (System.Text.RegularExpressions.Match match in regex.Matches(status))
			{
				status = status.Replace(match.Value, "");
				FileInfo file = new FileInfo(match.Value.Replace("[", "").Replace("]", ""));
				if (!file.Exists)
					throw new FileNotFoundException("File not found", file.FullName);
				media.Add(file);
            }

			if (media.Count > 4) //limited by the twitter API
				throw new ArgumentOutOfRangeException("media", "Up to 4 media files are allowed per tweet");

			if (user == null)
				user = TwUser.LoadCredentials();
			string encodedStatus = Util.EncodeString(status);
			
			if (media.Count == 0)
				return InternalUpdateStatus(user, encodedStatus, replyId);
			else
				return InternalUpdateWithMedia(user, encodedStatus, replyId, media);
		}
All Usage Examples Of System.Text.RegularExpressions.Regex::Matches