正则表达式用法小结
C#
获得匹配数据
MatchCollection mc = Regex.Matches(_url, @"href=[""'']([\s\S]*?)[""'']", RegexOptions.Singleline | RegexOptions.Multiline | RegexOptions.Singleline); foreach (Match item in mc) _url = item.Groups[1].Value;
JS
替换
txt = txt.replace(/(^[\s\n\t]+)|([\s\n\t]+$)/g, '');