Advertisement
AnarchyOnline

Youtube.xys 0.5.1

Apr 15th, 2013
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 16.52 KB | None | 0 0
  1. /******************************************************************************************************
  2. *** 40k's Xyplorer Youtube script 0.5                                                               ***
  3. ***                                                                                                 ***
  4. *** Special thanks to forum users Marco, Highend and klownboy                                       ***
  5. *** for their troubleshooting with video titles.                                                    ***
  6. ***                                                                                                 ***
  7. *** As of 0.5 this script now uses a configuration file nested in                                   ***
  8. *** XY's Scripts folder. The config file is initialized during                                      ***
  9. *** "_Initialize". The script also writes small .bat files into                                     ***
  10. *** that folder to improve performance on batch downloading with VLC                                ***
  11. *** These files should delete themselves. It is entirely possible to                                ***
  12. *** change all this in the code should you desire.                                                  ***
  13. ***                                                                                                 ***
  14. *** TEMPORARY LIMITATION:                                                                           ***
  15. ***     As of Xyplorer 12.30 a download file size limit of 100mb is                                 ***
  16. ***     in place for "Get Full Video - Xyplorer".                                                   ***
  17. ***     THIS LIMITATION IS SET TO DISAPPEAR IN THE COMING XY VERSIONS!                              ***
  18. ***                                                                                                 ***
  19. *** Please visit the script thread on the Xy forums at:                                             ***
  20. *** http://www.xyplorer.com/xyfc/viewtopic.php?f=7&t=9396&sid=194326252b4e01c78ffa00695a6eb953      ***
  21. ***                                                                                                 ***
  22. *** - 40k                                                                                           ***
  23. ******************************************************************************************************/
  24.  
  25. /* MAIN SCRIPT FUNCTIONS
  26.  * Main functions contain minimal unique code and are designed to chain smaller script modules
  27.  * to generate a desired output.
  28.  *
  29.  * FOR VLC MAIN FUNCTIONS:
  30.  * VLC sometimes parses a command line internally. Documentation on this is poor. This will result
  31.  * in buggy behavior. During testing most coming bugs have been worked around (mainly URL parsing).
  32.  * More specific bugs may still appear. Please post on the forum if you encounter odd behavior.
  33.  */
  34.  
  35. "_Initialize"
  36.  {
  37.  global $g_Vlc;
  38.  global $g_Downloads;
  39.  global $g_INIFile;
  40.  global $g_BATFile;
  41.  
  42.  $g_INIFile = "<xyscripts>\YouTube.ini";
  43.  $g_BATFile = "<xyscripts>\YouTube.bat";
  44.  
  45.  
  46.  if (exists($g_INIFile) == 1){
  47.  
  48.   $g_Vlc = getkey ('Vlc', 'Config', $g_INIFile, );
  49.   $g_Downloads = getkey ('Downloads', 'Config', $g_INIFile, );
  50.  } else {
  51.  
  52.   msg <<<#
  53. This is your first time running YouTube.xys 0.6 or you have deleted your configuration file. This configuration wizard helps you quickly configure the script for use. You can later edit your configuration file through the script.
  54.  
  55. 1. Select the location of vlc.exe
  56. 2. Select the location where you want downloads to appear
  57.  
  58. #;
  59.  
  60.   $g_Vlc = inputfile ("C:", "exe", "Configuration on first script run - Select vlc.exe");
  61.   $g_Downloads = inputfolder ("C:", "Configuration on first script run - Select desired download location");
  62.  
  63.   $Configuration = <<<#
  64. [Config]  
  65. Vlc=$g_Vlc
  66. Downloads=$g_Downloads
  67. #;
  68.   writefile ($g_INIFile, $Configuration, o, t);
  69.   msg <<<#
  70. The script is now configured for use!
  71. #;
  72.  }
  73.  }
  74.  
  75. "Download 1 Link - XY"
  76.  {
  77.  global $g_Downloads;
  78.  global $g_MetaTitle;
  79.  global $g_VersionsMenuChoiceExt;
  80.  global $g_PlayableUrl;
  81.  
  82.  sub "_Return-Playable-Url-XY";
  83.  download ($g_PlayableUrl, "$g_Downloads\$g_MetaTitle$g_VersionsMenuChoiceExt", u);
  84.  }
  85.  
  86. "Download 1 Link - VLC"
  87.  {
  88.  global $g_Vlc;
  89.  global $g_Downloads;
  90.  global $g_BATFile;
  91.  global $g_MetaTitle;
  92.  global $g_VersionsMenuChoiceExt;
  93.  global $g_PlayableUrl;
  94.  
  95.  sub "_Return-Playable-Url-VLC";
  96.  
  97.  $VlcCmd = '"'.$g_Vlc.'" --sout=#file{dst="'.$g_Downloads.'\'.$g_MetaTitle.$g_VersionsMenuChoiceExt.'"} :sout-keep "'.$g_PlayableUrl.'" vlc://quit';
  98. writefile ($g_BATFile, $VlcCmd."<crlf>del ".'"'.$g_BATFile.'"', o, t);
  99. run ($VlcCmd, , 0, 0);
  100. }
  101.  
  102. "Download 1 Link - VLC (Audio only)"
  103. {
  104. global $g_Vlc;
  105. global $g_Downloads;
  106. global $g_BATFile;
  107. global $g_MetaTitle;
  108. global $g_VersionsMenuChoiceExt;
  109. global $g_PlayableUrl;
  110.  
  111. sub "_Return-Playable-Url-VLC";
  112.  
  113. $VlcCmd = '"'.$g_Vlc.'" --sout=#transcode{vcodec=none}:file{dst="'.$g_Downloads.'\'.$g_MetaTitle.$g_VersionsMenuChoiceExt.'"} :sout-keep "'.$g_PlayableUrl.'" vlc://quit';
  114. writefile ($g_BATFile, $VlcCmd."<crlf>del ".'"'.$g_BATFile.'"', o, t);
  115. run ($g_BATFile, , 0, 0);
  116. }
  117.  
  118. "Download 1 Link - VLC (Video only)"
  119. {
  120. global $g_Vlc;
  121. global $g_Downloads;
  122. global $g_BATFile;
  123. global $g_MetaTitle;
  124. global $g_VersionsMenuChoiceExt;
  125. global $g_PlayableUrl;
  126.  
  127. sub "_Return-Playable-Url-VLC";
  128.  
  129. $VlcCmd = '"'.$g_Vlc.'" --sout=#transcode{acodec=none}:file{dst="'.$g_Downloads.'\'.$g_MetaTitle.$g_VersionsMenuChoiceExt.'"} :sout-keep "'.$g_PlayableUrl.'" vlc://quit';
  130. writefile ($g_BATFile, $VlcCmd."<crlf>del ".'"'.$g_BATFile.'"', o, t);
  131. run ($g_BATFile, , 0, 0);
  132. }
  133.  
  134. "Download Multiple Links - XY"
  135. {
  136. global $g_Vlc;
  137. global $g_Downloads;
  138. global $g_BATFile;
  139. global $g_YoutubeSourceUrl;
  140. global $g_MetaTitle;
  141. global $g_VersionsMenuChoiceExt;
  142. global $g_PlayableUrl;
  143.  
  144. $Urls = input ("Download Multiple Links - VLC", "Paste 1 Youtube link per line followed by Enter", , m, , , );
  145. foreach ($a, $Urls, "<crlf>"){ //$a is intermediate, foreach loop does not accept uninitialized global?
  146.  $g_YoutubeSourceUrl = $a;
  147.  sub "_Return-Playable-Urls-XY";
  148.  download ($g_PlayableUrl, "$g_Downloads\$g_MetaTitle$g_VersionsMenuChoiceExt", u);  
  149. }
  150. }
  151.  
  152. "Download Multiple Links - VLC"
  153. {
  154. global $g_Vlc;
  155. global $g_Downloads;
  156. global $g_BATFile;
  157. global $g_YoutubeSourceUrl;
  158. global $g_MetaTitle;
  159. global $g_VersionsMenuChoiceExt;
  160. global $g_PlayableUrl;
  161.  
  162. writefile ($g_BATFile, '', o, t);
  163.  
  164. $Urls = input ("Download Multiple Links - VLC", "Paste 1 Youtube link per line followed by Enter", , m, , , );
  165. foreach ($a, $Urls, "<crlf>"){ //$a is intermediate, foreach loop does not accept uninitialized global?
  166.  $g_YoutubeSourceUrl = $a;
  167.  sub "_Return-Playable-Urls-VLC";
  168.  
  169.  $VlcCmd = '"'.$g_Vlc.'" --sout=#file{dst="'.$g_Downloads.'\'.$g_MetaTitle.$g_VersionsMenuChoiceExt.'"} :sout-keep "'.$g_PlayableUrl.'" vlc://quit';
  170.  writefile ($g_BATFile, $VlcCmd."<crlf>", a, t);
  171. }
  172. writefile ($g_BATFile, "del ".'"'.$g_BATFile.'"', a, t);
  173. run ($g_BATFile, , 0, 0);
  174. }
  175.  
  176. "Podcast Encoder" //EXPERIMENTAL
  177. {
  178. global $g_Vlc;
  179. global $g_Downloads;
  180. global $g_BATFile;
  181. global $g_YoutubeSourceUrl;
  182. global $g_MetaTitle;
  183. global $g_VersionsMenuChoiceExt;
  184. global $g_PlayableUrl;
  185.  
  186. writefile ($g_BATFile, '', o, t);
  187.  
  188. $Acodec = inputselect ('Podcast Encoder - Choose your codec', 'mp3|mp4a|mpga|flac|vorb|a52|spx', '|', 0, , 300, 300);
  189. $Urls = input ("Download Multiple Links - VLC", "Paste 1 Youtube link per line followed by Enter", , m, , , );
  190.  
  191. foreach ($a, $Urls, "<crlf>"){ //$a is intermediate, foreach loop does not accept uninitialized global?
  192.  $g_YoutubeSourceUrl = $a;
  193.  sub "_Return-Playable-Urls-VLC";
  194.  
  195.  // Encoding GUI is still in testing phase during development of v.0.5
  196.  // To change output of encoding done by VLC change values in $VlcCmd below as follows:
  197.  // ab = Audio Bitrate in kb. (E.g: ab=128 is 128kb/s)
  198.  // channels = Audio channels encoded. Maximum is 8 (?)
  199.  // samplerate = Most commonly 44k or 48k
  200.  
  201.  $VlcCmd = '"'.$g_Vlc.'" --sout=#transcode{vcodec=none,acodec='.$Acodec.',ab=192,channels=2,samplerate=48000}:file{dst="'.$g_Downloads.'\'.$g_MetaTitle.'.'.$Acodec.'"} :sout-keep "'.$g_PlayableUrl.'" vlc://quit';
  202.  writefile ($g_BATFile, $VlcCmd."<crlf>", a, t);
  203. }
  204. writefile ($g_BATFile, "del ".'"'.$g_BATFile.'"', a, t);
  205. run ($g_BATFile, , 0, 0);  
  206. }
  207.  
  208. "File Encoder" //EXPERIMENTAL
  209. {
  210. global $g_Vlc;
  211. global $g_BATFile;
  212.  
  213. }
  214.  
  215.  
  216. /* SUPPORT SCRIPT FUNCTIONS
  217. * Support functions are designed to perform stand-alone tasks only and return results to the main script functions
  218. */
  219.  
  220. //------------------------------------Youtube Support scripts------------------------------------//
  221. "_Return-Playable-Url-XY"
  222. {
  223. global $g_YoutubeSourceUrl;
  224. global $g_YoutubeSourceContent;
  225.  
  226. $g_YoutubeSourceUrl = "<clipboard>";
  227. sub "_Youtube-Get-SourceData";
  228.  
  229. global $g_MetaTitle;
  230. global $g_MetaDescription;
  231. sub "_SourceData-Get-MetaData";
  232.  
  233. global $g_StreamMap;
  234. sub "_SourceData-Get-StreamMap";
  235. sub "_StreamMap-Decode-XY";
  236.  
  237. global $g_Itags;
  238. sub "_StreamMap-Get-Versions";
  239.  
  240. global $g_VersionsMenuList;
  241. global $g_VersionsMenuChoice;
  242. sub "_Versions-Get-Choice";
  243.  
  244. global $g_PlayableUrl;
  245. sub "_Choice-Create-PlayableUrl";  
  246. }
  247.  
  248. "_Return-Playable-Url-VLC"
  249. {
  250. global $g_YoutubeSourceUrl;
  251. global $g_YoutubeSourceContent;
  252.  
  253. $g_YoutubeSourceUrl = "<clipboard>";
  254. sub "_Youtube-Get-SourceData";
  255.  
  256. global $g_MetaTitle;
  257. global $g_MetaDescription;
  258. sub "_SourceData-Get-MetaData";
  259.  
  260. global $g_StreamMap;
  261. sub "_SourceData-Get-StreamMap";
  262. sub "_StreamMap-Decode-VLC";
  263.  
  264. global $g_Itags;
  265. sub "_StreamMap-Get-Versions";
  266.  
  267. global $g_VersionsMenuList;
  268. global $g_VersionsMenuChoice;
  269. sub "_Versions-Get-Choice";
  270.  
  271. global $g_PlayableUrl;
  272. sub "_Choice-Create-PlayableUrl";  
  273. }
  274.  
  275. "_Return-Playable-Urls-XY"
  276. {
  277. global $g_YoutubeSourceUrl;
  278. global $g_YoutubeSourceContent;
  279.  
  280. sub "_Youtube-Get-SourceData";
  281.  
  282. global $g_MetaTitle;
  283. global $g_MetaDescription;
  284. sub "_SourceData-Get-MetaData";
  285.  
  286. global $g_StreamMap;
  287. sub "_SourceData-Get-StreamMap";
  288. sub "_StreamMap-Decode-VLC";
  289.  
  290. global $g_Itags;
  291. sub "_StreamMap-Get-Versions";
  292.  
  293. global $g_VersionsMenuList;
  294. global $g_VersionsMenuChoice;
  295. sub "_Versions-Get-Choice";
  296.  
  297. global $g_PlayableUrl;
  298. sub "_Choice-Create-PlayableUrl";
  299. }
  300.  
  301. "_Return-Playable-Urls-VLC"
  302. {
  303. global $g_YoutubeSourceUrl;
  304. global $g_YoutubeSourceContent;
  305.  
  306. sub "_Youtube-Get-SourceData";
  307.  
  308. global $g_MetaTitle;
  309. global $g_MetaDescription;
  310. sub "_SourceData-Get-MetaData";
  311.  
  312. global $g_StreamMap;
  313. sub "_SourceData-Get-StreamMap";
  314. sub "_StreamMap-Decode-VLC";
  315.  
  316. global $g_Itags;
  317. sub "_StreamMap-Get-Versions";
  318.  
  319. global $g_VersionsMenuList;
  320. global $g_VersionsMenuChoice;
  321. sub "_Versions-Get-Choice";
  322.  
  323. global $g_PlayableUrl;
  324. sub "_Choice-Create-PlayableUrl";  
  325. }
  326.  
  327. "_Youtube-Get-SourceData"
  328. {
  329. global $g_YoutubeSourceUrl;
  330. global $g_YoutubeSourceContent;
  331.  
  332. if (regexmatches ($g_YoutubeSourceUrl, "http[s]?://www\.youtube\.com[^ ]+", , 0)){  
  333.  } else {
  334.   $g_YoutubeSourceUrl = input ("Youtube.com", "Paste Youtube video URL here", , s, , 300, 200);  
  335.  }
  336.   $g_YoutubeSourceContent = readurl ($g_YoutubeSourceUrl, 0, 0, 1);  
  337.  }
  338.  
  339. "_SourceData-Get-MetaData"
  340.  {
  341.  global $g_YoutubeSourceContent;
  342.  global $g_MetaTitle;
  343.  global $g_MetaDescription;
  344.  
  345.  $g_MetaTitle = regexmatches ($g_YoutubeSourceContent, '"og:title" content="[^"]+', , 0);
  346.  $g_MetaTitle = replace ($g_MetaTitle, '"og:title" content="', , , );
  347.  $g_MetaTitle = replacelist ($g_MetaTitle, "&quot;,&#34;", '', ",", 0);
  348.  $g_MetaTitle = replacelist ($g_MetaTitle, "&amp;,&#38;,&apos;,&#39;,&lt;,&#60;,&gt;,&#62;", "&,&,',',<,<,>,>", ",", 0);
  349.  $g_MetaTitle = replacelist ($g_MetaTitle, '/-\-:-*-?-<->-"-|-,', , '-', 0); // Remove comma as it interferes with VLC command line parameters
  350.  
  351.  $g_MetaDescription = regexmatches ($g_YoutubeSourceContent, '"og:description" content="[^"]+', , 0);
  352.  $g_MetaDescription = replace ($g_MetaDescription, '"og:description" content="', , , );
  353.  $g_MetaDescription = replacelist ($g_MetaDescription, "&quot;,&#34;", '"', ",", 0);
  354.  $g_MetaDescription = replacelist ($g_MetaDescription, "&amp;,&#38;,&apos;,&#39;,&lt;,&#60;,&gt;,&#62;", "&,&,',',<,<,>,>", ",", 0);
  355.  $g_MetaDescription = replacelist ($g_MetaDescription, "/,\,:,*,?,<,>,|", , ",", 0);  
  356.  }
  357.  
  358. "_SourceData-Get-StreamMap"
  359.  {
  360.  global $g_RegEx_Haystack;
  361.  global $g_RegEx_Needles;
  362.  global $g_RegEx_Marker;
  363.  global $g_RegEx_Result;
  364.  
  365.  global $g_YoutubeSourceContent;
  366.  global $g_StreamMap;
  367.  
  368.  $g_RegEx_Haystack = $g_YoutubeSourceContent;
  369.  $g_RegEx_Needles = '"url_encoded_fmt_stream_map": "[^"]+~\w+=[^,]+';
  370.  $g_RegEx_Marker = '~';
  371.  sub "_RegEx_Iso";
  372.  
  373.  $g_StreamMap = $g_RegEx_Result;
  374.  }
  375.  
  376. "_StreamMap-Decode-XY"
  377.  {
  378.  global $g_StreamMap;
  379.  $Streams = '';
  380.  
  381.  foreach ($Map, $g_StreamMap, "|"){
  382.   $Map = urldecode ($Map, 1);
  383.   $Map = replacelist ($Map, '\u0026,sig', '&,signature', ",", 0);  
  384.   $Streams = $Streams.$Map.'|';
  385.  }
  386.  $g_StreamMap = formatlist ($Streams, "e", "|", );
  387.  }
  388.  
  389. "_StreamMap-Decode-VLC"
  390.  {
  391.  global $g_StreamMap;
  392.  $Streams = '';
  393.  
  394.  foreach ($Map, $g_StreamMap, "|"){
  395.   $Map = urldecode ($Map, 1);
  396.   $Map = replacelist ($Map, '\u0026|sig|%2C', '&|signature|,', "|", 0);  
  397.   $Streams = $Streams.$Map.'|';
  398.  }
  399.  $g_StreamMap = formatlist ($Streams, "e", "|", );
  400.  }
  401.  
  402. "_StreamMap-Get-Versions"
  403.  {
  404.  global $g_StreamMap;
  405.  global $g_Itags;
  406.  
  407.  $g_Itags = regexmatches ($g_StreamMap, 'itag=\d+', '|', 0);
  408.  $g_Itags = replace ($g_Itags, 'itag=', , , , );
  409.  $g_Itags = formatlist ($g_Itags, "d", '|', );
  410.  }
  411.  
  412. "_Versions-Get-Choice"
  413.  {
  414.  global $g_VersionsMenuList;
  415.  global $g_VersionsMenuChoice;
  416.  global $g_VersionsMenuChoiceExt;
  417.  global $g_Itags;
  418.  
  419.  global $g_MetaTitle;
  420.  global $g_MetaDescription;
  421.  
  422.  $ThreeGP =
  423.  "
  424. >[036] 240p - 3GP
  425. >[017] 144p - 3GP
  426. >[013] Unknown - 3GP
  427. ";
  428.  
  429.  $Flv =
  430.  "
  431. >[035] 480p - FLV
  432. >[034] 360p - FLV
  433. >[006] 270p - FLV
  434. >[005] 240p - FLV
  435. ";
  436.  
  437.  $Webm =
  438.  "
  439. >[046] 1080p - WebM
  440. >[045] 720p - WebM
  441. >[044] 480p - WebM
  442. >[043] 360p - WebM
  443. ";
  444.  
  445.  $Mp4 =
  446.  "
  447. >[038] 3072p - MP4
  448. >[037] 1080p - MP4
  449. >[022] 720p - MP4
  450. >[018] 360p - MP4
  451. ";
  452.  
  453.  $DataBase = replace($ThreeGP.$Flv.$Webm.$Mp4, ' >', , 0, , );
  454.  $g_VersionsMenuList = '';
  455.  
  456.  foreach ($Tag, $g_Itags, '|'){
  457.   $Tag = format ($Tag, '000'); //format itags to 3 digits
  458.   $g_VersionsMenuList = $g_VersionsMenuList.regexmatches($DataBase, "\[$Tag\][^\[]+", , 0).'|'; //Create list from available qualities
  459.  }
  460.  
  461.  $g_VersionsMenuChoice = inputselect ("Choose video quality:<crlf 2>$g_MetaTitle", $g_VersionsMenuList, "|", 0, , , , );
  462.  
  463.  $g_VersionsMenuChoiceExt = '.'.recase(regexmatches ($g_VersionsMenuChoice, "3GP|FLV|MP4|WebM", , 0), l, );
  464.  $g_VersionsMenuChoice = regexmatches ($g_VersionsMenuChoice, "\[\d+\]", , 0);
  465.  $g_VersionsMenuChoice = replacelist ($g_VersionsMenuChoice, '[,]', , ',', );
  466.  $g_VersionsMenuChoice = trim ($g_VersionsMenuChoice, "0", "L");
  467.  }
  468.  
  469. "_Choice-Create-PlayableUrl"
  470.  {
  471.  global $g_StreamMap;
  472.  global $g_VersionsMenuChoice;
  473.  global $g_PlayableUrl;
  474.  
  475.  $g_PlayableUrl = regexmatches ($g_StreamMap, "[^|]+([&]?itag=$g_VersionsMenuChoice[^|]+)", , 0);
  476.  
  477.  $HttpFront = regexmatches ($g_PlayableUrl, "http:[^&]+", , 0);
  478.  $g_PlayableUrl = regexreplace ($g_PlayableUrl, "[&]?(type|quality|itag|fallback_host|url)=[^&]+", , 0);
  479.  $g_PlayableUrl = regexreplace ($g_PlayableUrl, "[?][&]", , 0);
  480.  
  481.  $g_PlayableUrl = $HttpFront.'&'.$g_PlayableUrl."&itag=$g_VersionsMenuChoice";
  482.  $g_PlayableUrl = replace ($g_PlayableUrl, '&&', '&', , , ); //quick fix to prevent & disappearing after httpfront move
  483.  }
  484.  
  485. //------------------------------------Encoder Support scripts------------------------------------//  
  486.  
  487.  
  488. //------------------------------------Regular Expression Engine------------------------------------//  
  489. "_RegEx_Iso"
  490.  {
  491.  /*
  492.  _RegEx_Iso is a sub script that will recursively search a text source.
  493.  By using sequenced regular expressions it is able to isolate embedded text that you
  494.  can not isolate using just a single regular expression.
  495.  
  496.  You must define global variables Haystack, Needles, and Marker in your script as the "arguments"
  497.  to the "method" _RegEx_Iso.
  498.  
  499.  E.g:
  500.  
  501.  $g_RegEx_Haystack = $Source;
  502.  $g_RegEx_Needles = "www\.youtube\.com\/user\/[^""]+"."~"."[^\/]+$";
  503.  $g_RegEx_Marker = "~";
  504.  sub "_RegEx_Iso";
  505.  
  506.  text $g_RegEx_Result;
  507.  */  
  508.  
  509.  global $g_RegEx_Haystack;                      // Text source to search in
  510.  global $g_RegEx_Needles;                       // List of recursive regex to be used
  511.  global $g_RegEx_Marker;                        // Delimiting character used to sequence list of regex
  512.  global $g_RegEx_Result;                        // Result of the search are demarked by "|"
  513.  
  514.  $j = $g_RegEx_Haystack;
  515.  $k = $g_RegEx_Needles;
  516.  $l = $g_RegEx_Marker;
  517.  
  518.  foreach ($i, $k, $l){
  519.   $j = regexmatches ("$j", "$i", "|", "0");
  520.  }
  521.  $g_RegEx_Result = $j;
  522.  
  523.  }
  524.  
  525. "_DEBUGRegEx_Iso"
  526.  {
  527.  /*
  528.  _DEBUGRegEx_Iso will do exactly the same as "_RegEx_Iso".
  529.  In addition it will show the Haystack, Needle, Marker and Result for each
  530.  recursive regular expression cycle. Useful to identify buggy behavior.
  531.  */  
  532.  
  533.  global $g_RegEx_Haystack;
  534.  global $g_RegEx_Needles;
  535.  global $g_RegEx_Marker;
  536.  global $g_RegEx_Result;
  537.  
  538.  $j = $g_RegEx_Haystack;
  539.  $k = $g_RegEx_Needles;
  540.  $l = $g_RegEx_Marker;
  541.  
  542.  foreach ($i, $k, $l){
  543.   text "$j";
  544.   $j = regexmatches ("$j", "$i", "|", "0");
  545.   text "$j <crlf 2>$i <crlf 2>$l";
  546.  }
  547.  $g_RegEx_Result = $j;  
  548.  
  549.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement