$re = '/@ref.*\\\\([^"]*)/m';
$str = '{
"creatingLibrary": {
"name": "MediaInfoLib",
"version": "22.06",
"url": "https://mediaarea.net/MediaInfo"
},
"media": {
"@ref": "\\\\\\\\169.254.10.124\\\\AVShed\\\\TVSeries\\\\Stargate SG-1 (1997)\\\\-S10 (2006)\\\\Stargate SG-1 -s10e20- Unending.mkv",
"track": [
{
"@type": "General",
"UniqueID": "116132281707487418698007962344120280727",
"VideoCount": "1",
"AudioCount": "2",
"TextCount": "1",
"FileExtension": "mkv",
"Format": "Matroska",
"Format_Version": "4",
"FileSize": "433474734",
"Duration": "2614.800",
"OverallBitRate": "1326219",
"FrameRate": "23.976",
"FrameCount": "62692",
"IsStreamable": "Yes",
"Encoded_Date": "UTC 2021-08-11 16:51:30",
"File_Created_Date": "UTC 2021-08-11 18:21:38.171",
"File_Created_Date_Local": "2021-08-12 02:21:38.171",
"File_Modified_Date": "UTC 2021-08-11 18:21:44.894",
"File_Modified_Date_Local": "2021-08-12 02:21:44.894",
"Encoded_Application": "HandBrake 1.3.3 2020061300",
"Encoded_Library": "Lavf58.29.100",
"extra": {
"ErrorDetectionType": "Per level 1"
}
},
{
"@type": "Video",
"StreamOrder": "0",
"ID": "1",
"UniqueID": "1",
"Format": "HEVC",
"Format_Profile": "Main",
"Format_Level": "4.1",
"Format_Tier": "Main",
"CodecID": "V_MPEGH/ISO/HEVC",
"Duration": "2614.779000000",
"Width": "1278",
"Height": "720",
"Stored_Width": "1280",
"Sampled_Width": "1278",
"Sampled_Height": "720",
"PixelAspectRatio": "1.000",
"DisplayAspectRatio": "1.775",
"FrameRate_Mode": "CFR",
"FrameRate": "23.976",
"FrameCount": "62692",
"ColorSpace": "YUV",
"ChromaSubsampling": "4:2:0",
"BitDepth": "8",
"Delay": "0.021",
"Encoded_Library": "x265 - 3.2.1+1-b5c86a64bbbe:[Windows][GCC 9.2.0][64 bit] 8bit+10bit+12bit",
"Encoded_Library_Name": "x265",
"Encoded_Library_Version": "3.2.1+1-b5c86a64bbbe:[Windows][GCC 9.2.0][64 bit] 8bit+10bit+12bit",
"Encoded_Library_Settings": "cpuid=1111039 / frame-threads=2 / numa-pools=4 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=1278x720 / interlace=0 / total-frames=0 / level-idc=41 / high-tier=1 / uhd-bd=0 / ref=4 / no-allow-non-conformance / no-repeat-headers / annexb / no-aud / no-hrd / info / hash=0 / no-temporal-layers / open-gop / min-keyint=24 / keyint=240 / gop-lookahead=0 / bframes=4 / b-adapt=2 / b-pyramid / bframe-bias=0 / rc-lookahead=25 / lookahead-slices=4 / scenecut=40 / radl=0 / no-splice / no-intra-refresh / ctu=64 / min-cu-size=8 / no-rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=2 / dynamic-rd=0.00 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / no-strong-intra-smoothing / max-merge=3 / limit-refs=3 / limit-modes / me=3 / subme=3 / merange=57 / temporal-mvp / no-hme / weightp / no-weightb / no-analyze-src-pics / deblock=0:0 / sao / no-sao-non-deblock / rd=4 / selective-sao=4 / no-early-skip / rskip / no-fast-intra / no-tskip-fast / no-cu-lossless / no-b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.00 / psy-rdoq=1.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=abr / bitrate=1050 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=2 / cplxblur=20.0 / qblur=0.5 / ipratio=1.40 / pbratio=1.30 / aq-mode=1 / aq-strength=1.00 / cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=1 / overscan=0 / videoformat=5 / range=0 / colorprim=1 / transfer=1 / colormatrix=1 / chromaloc=0 / display-window=0 / cll=0,0 / min-luma=0 / max-luma=255 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / no-opt-qp-pps / no-opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-bias=0.05 / no-opt-cu-delta-qp / no-aq-motion / no-hdr / no-hdr-opt / no-dhdr10-opt / no-idr-recovery-sei / analysis-reuse-level=5 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=1 / refine-ctu-distortion=0 / no-limit-sao / ctu-info=0 / no-lowpass-dct / refine-analysis-type=0 / copy-pic=1 / max-ausize-factor=1.0 / no-dynamic-refine / no-single-sei / no-hevc-aq / no-svt / no-field / qp-adaptation-range=1.00",
"Default": "Yes",
"Forced": "No",
"colour_description_present": "Yes",
"colour_description_present_Source": "Stream",
"colour_range": "Limited",
"colour_range_Source": "Stream",
"colour_primaries": "BT.709",
"colour_primaries_Source": "Stream",
"transfer_characteristics": "BT.709",
"transfer_characteristics_Source": "Stream",
"matrix_coefficients": "BT.709",
"matrix_coefficients_Source": "Stream"
},
{
"@type": "Audio",
"@typeorder": "1",
"StreamOrder": "1",
"ID": "2",
"UniqueID": "2",
"Format": "AAC",
"Format_Settings_SBR": "No (Explicit)",
"Format_AdditionalFeatures": "LC",
"CodecID": "A_AAC-2",
"Duration": "2614.762000000",
"Channels": "2",
"ChannelPositions": "Front: L R",
"ChannelLayout": "L R",
"SamplesPerFrame": "1024",
"SamplingRate": "48000",
"SamplingCount": "125508576",
"FrameRate": "46.875",
"Compression_Mode": "Lossy",
"Delay": "0.000",
"Delay_Source": "Container",
"Title": "Stereo",
"Language": "en",
"Default": "Yes",
"Forced": "No"
},
{
"@type": "Audio",
"@typeorder": "2",
"StreamOrder": "2",
"ID": "3",
"UniqueID": "3",
"Format": "AAC",
"Format_AdditionalFeatures": "LC",
"CodecID": "A_AAC-2",
"Duration": "2614.741000000",
"Channels": "2",
"ChannelPositions": "Front: L R",
"ChannelLayout": "L R",
"SamplesPerFrame": "1024",
"SamplingRate": "48000",
"SamplingCount": "125507568",
"FrameRate": "46.875",
"Compression_Mode": "Lossy",
"Delay": "0.041",
"Delay_Source": "Container",
"Title": "Commentary",
"Language": "en",
"Default": "No",
"Forced": "No"
},
{
"@type": "Text",
"StreamOrder": "3",
"ID": "4",
"UniqueID": "4",
"Format": "PGS",
"CodecID": "S_HDMV/PGS",
"Duration": "2560.329000000",
"Title": "SDH",
"Language": "en",
"Default": "No",
"Forced": "No"
}
]
}
}
';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
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 PHP, please visit: http://php.net/manual/en/ref.pcre.php