using System.Text.RegularExpressions; public static class StringExt { private static readonly Regex COLOR_TAG_PATTERN = new Regex( @"(\[[0-9A-F]{6}\])", RegexOptions.IgnoreCase ); public static bool ContainsColorTag( this string self ) { return COLOR_TAG_PATTERN.IsMatch( self ); } }
var text = "[ffff00]ピカチュウ[-]";
Debug.Log( text.ContainsColorTag() );