using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(url|href|src)\s*[=\(]\s*(['""][^'""]+['""]|[^\s\)]+)(?=(\/?>|\s*\)))?";
string input = @"url(wp-content/plugins/accordions/assets/global/webfonts/fa-brands-400.woff)
url(""wp-content/plugins/accordions/assets/global/webfonts/fa-brands-400.woff"")
url('wp-content/plugins/accordions/assets/global/webfonts/fa-brands-400.woff')
url ( wp-content/plugins/accordions/assets/global/webfonts/fa-brands-400.woff )
url ( ""wp-content/plugins/accordions/assets/global/webfonts/fa-brands-400.woff"" )
url ( 'wp-content/plugins/accordions/assets/global/webfonts/fa-brands-400.woff' )
url(wp-content/plugins/accordions/assets/global/webfonts/fa-brands-400.woff)
url(""wp-con)tent/plugins/accordions/assets/global/webfonts/fa-brands-400.woff"")
url('wp-cont)ent/plugins/accordions/assets/global/webfonts/fa-brands-400.woff')
url ( wp-content/plugins/accordions/assets/global/webfonts/fa-brands-400.woff )
url ( ""wp-con)tent/plugins/accordions/assets/global/webfonts/fa-brands-400.woff"" )
url ( 'wp-cont)ent/plugins/accordions/assets/global/webfonts/fa-brands-400.woff' )
-------
<link rel='stylesheet' id='base-css' href='wp-content/themes/biopic/stylesheets/base.css?ver=5.1.2' type='text/css' media='all' />
<link rel='stylesheet' id='base-css' href=""wp-content/themes/biopic/stylesheets/base.css?ver=5.1.2"" type='text/css' media='all' />
<link rel='stylesheet' id='base-css' href=wp-content/themes/biopic/stylesheets/base.css?ver=5.1.2 type='text/css' media='all' />
<link rel='stylesheet' id='base-css' href = 'wp-content/themes/biopic/stylesheets/base.css?ver=5.1.2' type='text/css' media='all' />
<link rel='stylesheet' id='base-css' href = ""wp-content/themes/biopic/stylesheets/base.css?ver=5.1.2"" type='text/css' media='all' />
<link rel='stylesheet' id='base-css' href = wp-content/themes/biopic/stylesheets/base.css?ver=5.1.2 type='text/css' media='all' />
<link rel='stylesheet' id='base-css' href='wp-content/themes/biopic/stylesheets/base.css?ver=5.1.2'/>
<link rel='stylesheet' id='base-css' href=""wp-content/themes/biopic/stylesheets/base.css?ver=5.1.2""/>
<link rel='stylesheet' id='base-css' href=wp-content/themes/biopic/stylesheets/base.css?ver=5.1.2/>
<link rel='stylesheet' id='base-css' href = 'wp-content/themes/biopic/stylesheets/base.css?ver=5.1.2'/>
<link rel='stylesheet' id='base-css' href = ""wp-content/themes/biopic/stylesheets/base.css?ver=5.1.2""/>
<link rel='stylesheet' id='base-css' href = wp-content/themes/biopic/stylesheets/base.css?ver=5.1.2 />";
RegexOptions options = RegexOptions.Multiline;
foreach (Match m in Regex.Matches(input, pattern, options))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx