Dotfiles, utilities, and other apparatus.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

preg-replace.php 335B

12345678910111213141516
  1. <?php
  2. $url = 'https://www.mouser.com/images/keystoneelectronics/images/Battery_1047_SPL.jpg';
  3. print $url . "\n";
  4. print preg_replace('
  5. {
  6. ^ # start of line
  7. (.*images/) # domain etc.
  8. (.*)/images/ # middle bit
  9. (.*) # image filename
  10. $ # EOL
  11. }x',
  12. '$1$2/lrg/$3',
  13. $url
  14. );