using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(?(DEFINE)(?P<space>[\s\n]*))(?(DEFINE)(?P<string>(""[^""]*"")))(?(DEFINE)(?P<integer>\d+))(?(DEFINE)(?P<PValue>((?P>string)|(?P>integer))))(?(DEFINE)(?P<PSV>(?P>space):(?P>space)))(?(DEFINE)(?P<PSP>(?P>space),(?P>space)))(?(DEFINE)(?P<PName>(?P>string))(?>(?P>PSV)))(?(DEFINE)(?P<property>(?P>PName)(?>(?P>PSV))(?P>PValue)(?>(?P>PSP)?)))""progressive""(?P>PSV)\[(?P>space)({(?P>property)*}(?P>PSP)?)*]}";
string input = @"{""cdn_url"":""https://f.vimeocdn.com"",""vimeo_api_url"":""api.vimeo.com"",""request"":{""files"":{""dash"":{""separate_av"":true,""streams"":[{""profile"":175,""quality"":""1080p"",""id"":1145512740,""fps"":29},{""profile"":174,""quality"":""720p"",""id"":1145512738,""fps"":29},{""profile"":165,""quality"":""540p"",""id"":1145512744,""fps"":29},{""profile"":164,""quality"":""360p"",""id"":1145512736,""fps"":29}],""cdns"":{""akfire_interconnect_quic"":{""url"":""https://70vod-adaptive.akamaized.net/exp=1625236953~acl=%2F297516469%2F%2A~hmac=5b01a595f1e4f157e4fe5f2fe02c02172fad388bc96134e98b2e074036271c81/297516469/sep/video/1145512744,1145512736,1145512740,1145512738/master.json?base64_init=1"",""origin"":""gcs"",""avc_url"":""https://70vod-adaptive.akamaized.net/exp=1625236953~acl=%2F297516469%2F%2A~hmac=5b01a595f1e4f157e4fe5f2fe02c02172fad388bc96134e98b2e074036271c81/297516469/sep/video/1145512744,1145512736,1145512740,1145512738/master.json?base64_init=1""},""fastly_skyfire"":{""url"":""https://skyfire.vimeocdn.com/1625236953-0x94f30a69d6f8014b17c26756cf08b17770b206b7/297516469/sep/video/1145512744,1145512736,1145512740,1145512738/master.json?base64_init=1"",""origin"":""gcs"",""avc_url"":""https://skyfire.vimeocdn.com/1625236953-0x94f30a69d6f8014b17c26756cf08b17770b206b7/297516469/sep/video/1145512744,1145512736,1145512740,1145512738/master.json?base64_init=1""}},""streams_avc"":[{""profile"":175,""quality"":""1080p"",""id"":1145512740,""fps"":29},{""profile"":174,""quality"":""720p"",""id"":1145512738,""fps"":29},{""profile"":165,""quality"":""540p"",""id"":1145512744,""fps"":29},{""profile"":164,""quality"":""360p"",""id"":1145512736,""fps"":29}],""default_cdn"":""akfire_interconnect_quic""},""hls"":{""separate_av"":true,""default_cdn"":""akfire_interconnect_quic"",""cdns"":{""akfire_interconnect_quic"":{""url"":""https://70vod-adaptive.akamaized.net/exp=1625236953~acl=%2F297516469%2F%2A~hmac=5b01a595f1e4f157e4fe5f2fe02c02172fad388bc96134e98b2e074036271c81/297516469/sep/video/1145512744,1145512740,1145512738,1145512736/subtitles/5954062-English-en-cc/master.m3u8?external-subs=1"",""origin"":""gcs"",""captions"":""https://70vod-adaptive.akamaized.net/exp=1625236953~acl=%2F297516469%2F%2A~hmac=5b01a595f1e4f157e4fe5f2fe02c02172fad388bc96134e98b2e074036271c81/297516469/video/1145512744,1145512740,1145512738,1145512736/subtitles/5954062-English-en-cc/master.m3u8"",""avc_url"":""https://70vod-adaptive.akamaized.net/exp=1625236953~acl=%2F297516469%2F%2A~hmac=5b01a595f1e4f157e4fe5f2fe02c02172fad388bc96134e98b2e074036271c81/297516469/sep/video/1145512744,1145512740,1145512738,1145512736/subtitles/5954062-English-en-cc/master.m3u8?external-subs=1""},""fastly_skyfire"":{""url"":""https://skyfire.vimeocdn.com/1625236953-0x94f30a69d6f8014b17c26756cf08b17770b206b7/297516469/sep/video/1145512744,1145512740,1145512738,1145512736/subtitles/5954062-English-en-cc/master.m3u8?external-subs=1"",""origin"":""gcs"",""captions"":""https://skyfire.vimeocdn.com/1625236953-0x94f30a69d6f8014b17c26756cf08b17770b206b7/297516469/video/1145512744,1145512740,1145512738,1145512736/subtitles/5954062-English-en-cc/master.m3u8"",""avc_url"":""https://skyfire.vimeocdn.com/1625236953-0x94f30a69d6f8014b17c26756cf08b17770b206b7/297516469/sep/video/1145512744,1145512740,1145512738,1145512736/subtitles/5954062-English-en-cc/master.m3u8?external-subs=1""}},""captions"":""https://70vod-adaptive.akamaized.net/exp=1625236953~acl=%2F297516469%2F%2A~hmac=5b01a595f1e4f157e4fe5f2fe02c02172fad388bc96134e98b2e074036271c81/297516469/video/1145512744,1145512740,1145512738,1145512736/subtitles/5954062-English-en-cc/master.m3u8""},""progressive"":[{""profile"":165,""width"":960,""mime"":""video/mp4"",""fps"":29,""url"":""https://vod-progressive.akamaized.net/exp=1625236953~acl=%2A%2F1145512744.mp4%2A~hmac=5a46a7570ab11f10d348ceddfffa775af5e31e24556fed41f27027cf227d46f2/vimeo-prod-skyfire-std-us/01/4503/11/297516469/1145512744.mp4"",""cdn"":""akamai_interconnect"",""quality"":""540p"",""id"":1145512744,""origin"":""gcs"",""height"":540},{""profile"":175,""width"":1920,""mime"":""video/mp4"",""fps"":29,""url"":""https://vod-progressive.akamaized.net/exp=1625236953~acl=%2A%2F1145512740.mp4%2A~hmac=cdc5cc4b0123ad31a7a4ec0b6eb2733d805a75276061e9b0a45692666f0fae7f/vimeo-prod-skyfire-std-us/01/4503/11/297516469/1145512740.mp4"",""cdn"":""akamai_interconnect"",""quality"":""1080p"",""id"":1145512740,""origin"":""gcs"",""height"":1080},{""profile"":174,""width"":1280,""mime"":""video/mp4"",""fps"":29,""url"":""https://vod-progressive.akamaized.net/exp=1625236953~acl=%2A%2F1145512738.mp4%2A~hmac=b9beb85f169fb55f0ba77315dca7a8b3161ba38d84f787e9d0c0dc0add4714e5/vimeo-prod-skyfire-std-us/01/4503/11/297516469/1145512738.mp4"",""cdn"":""akamai_interconnect"",""quality"":""720p"",""id"":1145512738,""origin"":""gcs"",""height"":720},{""profile"":164,""width"":640,""mime"":""video/mp4"",""fps"":29,""url"":""https://vod-progressive.akamaized.net/exp=1625236953~acl=%2A%2F1145512736.mp4%2A~hmac=628116b0bab13b6c3e57434efb717db099a1b177d83a03a437612b64a9b196bb/vimeo-prod-skyfire-std-us/01/4503/11/297516469/1145512736.mp4"",""cdn"":""akamai_interconnect"",""quality"":""360p"",""id"":1145512736,""origin"":""gcs"",""height"":360}]},""lang"":""en"",""sentry"":{""url"":""https://6f5f8e1cecfa40fb850f578b69fc1705@o189131.ingest.sentry.io/1297650"",""enabled"":false,""debug_enabled"":true,""debug_intent"":0},""ab_tests"":{""chromecast"":{""track"":false,""data"":{},""group"":false},""live_switch"":{""track"":true,""data"":{},""group"":true,""mux"":true},""stats_fresnel"":{""track"":false,""data"":{},""group"":true},""llhls_timeout"":{""track"":true,""data"":{},""group"":false}},""referrer"":null,""cookie_domain"":"".vimeo.com"",""timestamp"":1625233053,""gc_debug"":{""bucket"":""vimeo-player-debug""},""expires"":3600,""text_tracks"":[{""lang"":""en"",""url"":""/texttrack/5954062.vtt?token=60df24ad_0xa79db60f27d49510606c020a71e97a5a13a13584"",""kind"":""captions"",""id"":5954062,""label"":""English""}],""client"":{""ip"":""51.159.169.65""},""currency"":""EUR"",""session"":""c0bb25198da4418812c2d43a4957c333b93d23af1625233053"",""cookie"":{""scaling"":1,""volume"":0.509765625,""quality"":null,""hd"":0,""captions"":""en.captions""},""build"":{""backend"":""1.39.12"",""js"":""3.36.8""},""urls"":{""barebone_js"":""https://f.vimeocdn.com/p/3.36.8/js/barebone.js"",""test_imp"":""https://fresnel.vimeocdn.com/add/player-test-impression"",""js_base"":""https://f.vimeocdn.com/p/3.36.8/js/"",""fresnel"":""https://fresnel.vimeocdn.com/add/player-stats"",""js"":""https://f.vimeocdn.com/p/3.36.8/js/player.js"",""proxy"":""https://player.vimeo.com/static/proxy.html"",""mux_url"":""https://f.vimeocdn.com/p/external/mux.js"",""fresnel_mimir_inputs_url"":""https://fresnel-events.vimeocdn.com/add/mimir_inputs"",""fresnel_chunk_url"":""https://fresnel-events.vimeocdn.com/add/chunk_downloads"",""three_js"":""https://f.vimeocdn.com/p/external/three.rvimeo.min.js"",""vuid_js"":""https://f.vimeocdn.com/js_opt/modules/utils/vuid.min.js"",""fresnel_manifest_url"":""https://fresnel-events.vimeocdn.com/add/playback_manifest"",""chromeless_css"":""https://f.vimeocdn.com/p/3.36.8/css/chromeless.css"",""player_telemetry_url"":""https://player-telemetry.vimeo.com/player-events"",""chromeless_js"":""https://f.vimeocdn.com/p/3.36.8/js/chromeless.js"",""css"":""https://f.vimeocdn.com/p/3.36.8/css/player.css""},""signature"":""e3289bbd42e32a4b05708edde056278f"",""flags"":{""dnt"":0,""preload_video"":""metadata_on_hover"",""plays"":1,""partials"":1,""autohide_controls"":0},""country"":""FR"",""file_codecs"":{""hevc"":{""hdr"":[],""sdr"":[]},""av1"":[],""avc"":[1145512744,1145512740,1145512738,1145512736]}},""player_url"":""player.vimeo.com"",""video"":{""version"":{""current"":null,""available"":[{""is_current"":1,""id"":34826681,""file_id"":1145512078},{""is_current"":0,""id"":33861705,""file_id"":1138981157},{""is_current"":0,""id"":33322165,""file_id"":1135375115},{""is_current"":0,""id"":33111956,""file_id"":1133908546}]},""height"":1080,""duration"":313,""thumbs"":{""1280"":""https://i.vimeocdn.com/video/735214418_1280"",""960"":""https://i.vimeocdn.com/video/735214418_960"",""640"":""https://i.vimeocdn.com/video/735214418_640"",""base"":""https://i.vimeocdn.com/video/735214418""},""owner"":{""account_type"":""live_premium"",""name"":""Vue Mastery"",""img"":""https://i.vimeocdn.com/portrait/23998031_60x60.jpg"",""url"":""https://vimeo.com/vuemastery"",""img_2x"":""https://i.vimeocdn.com/portrait/23998031_120x120.jpg"",""id"":72160148},""id"":297516469,""embed_code"":""<iframe title=\""vimeo-player\"" src=\""https://player.vimeo.com/video/297516469\"" width=\""640\"" height=\""360\"" frameborder=\""0\"" allowfullscreen><\/iframe>"",""title"":""Vuex Intro for VM"",""share_url"":""https://vimeo.com/297516469"",""width"":1920,""embed_permission"":""public"",""fps"":29.97,""spatial"":0,""logo_url"":null,""live_event"":null,""allow_hd"":1,""hd"":1,""lang"":null,""default_to_hd"":0,""url"":null,""privacy"":""disable"",""bypass_token"":""eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJjbGlwX2lkIjoyOTc1MTY0NjksImV4cCI6MTYyNTIzNjIwMH0.1DqNuXaVbKAgAW729lLvu0Q0W1OXkHesAtfLNc_6KIk"",""unlisted_hash"":null},""user"":{""team_origin_user_id"":0,""liked"":0,""account_type"":""none"",""vimeo_api_client_token"":null,""vimeo_api_interaction_tokens"":null,""team_id"":0,""watch_later"":0,""owner"":0,""id"":0,""mod"":0,""logged_in"":0},""embed"":{""autopause"":1,""playsinline"":1,""settings"":{""fullscreen"":1,""byline"":0,""like"":0,""playbar"":1,""title"":0,""color"":1,""speed"":1,""watch_later"":0,""share"":0,""scaling"":1,""spatial_compass"":0,""collections"":0,""info_on_pause"":0,""portrait"":0,""logo"":0,""embed"":0,""badge"":0,""spatial_label"":0,""volume"":1},""color"":""39b982"",""texttrack"":"",""on_site"":0,""app_id"":""122963"",""muted"":0,""dnt"":0,""player_id"":"",""api"":null,""editor"":false,""context"":""embed.main"",""time"":0,""outro"":""nothing"",""log_plays"":1,""quality"":null,""transparent"":1,""loop"":0,""autoplay"":1},""view"":1,""vimeo_url"":""vimeo.com""}; if (!config.request) { return; } if (typeof config.request === 'object' && 'error' in config.request) { if ('html' in config.request) { document.documentElement.innerHTML = config.request.html.replace(/</g, '<').replace(/>/g, '>'); } return; } var isIframe = (function() { try { return window.self !== window.top; } catch (e) { return true; } }()); if (!isIframe && /twitter/i.test(navigator.userAgent) && config.video.url) { window.location = config.video.url; }";
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