using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"<script>.*(adsConfig).*<\/script>";
string input = @"<script>
var middleCount = 0;
var = {
nonLinear: {
url: ""https://8245.digital/vpaid/?id=7875&type=nonlinear&dcc=1"",
total: 0 ,
offset: 10 * 60,
label: { name: 'label', val: 'overlay', counter: true }
},
pre: {
maxImpressions: 2 ,
urls: [""https://8245.digital/vpaid/?id=5241&label=preroll&dcc=1&maximp=2&synconly=1""]
},
middle: {
pop: true,
maxTotalImp: 0 ,
maxImpressions: 1,
urls: [""https://8245.digital/vpaid/?id=21515&synconly=1&maximp=1&dcc=1&mid=6"",""https://8245.digital/vpaid/?id=5242&synconly=1&maximp=1&dcc=1&mid=6""]
,
getUrls: function () {
var u = middleCount && .middle.urls
? .middle.urls.slice(1)
: .middle.urls;
middleCount++;
return u;
},
label: { name: 'label', val: 'middleroll', counter: true }
},
confirmTimeout: 60 * 1000,
confirmOn: ['localhost', 'zombie-film.net'],
vast: {timeouts: {loading: 20000, starting: 20000, global: 120000}},
volume: 0.3,
tv: true,
suppressOnFakeFullScreen: true
};
</script>";
RegexOptions options = RegexOptions.Singleline | RegexOptions.Multiline;
Match m = Regex.Match(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