Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8460375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:35:22+00:00 2026-06-10T13:35:22+00:00

I am trying to do a regex match and replace for hotfile.com links to

  • 0

I am trying to do a regex match and replace for hotfile.com links to mp3 files i have in my database (WordPress).

I used to use hotfile for streaming mp3 files on my site, now i switched to a CDN, could someone kindly help me out with this:

Replace: http//hotfile.com/dl/157490069/c8732d4/mp3_file_name.mp3
With: http//p.music.cdndomain.com/vod/music.folder/2010/mp3_file_name.mp3

I have been trying a simple Search and Replace like this: http//hotfile.com/dl/%/%/, but its not working.

It would have been easier to perform a search and replace if hotfile.com didn’t have different folders for all files, below is 2 examples of the problem:

http//hotfile.com/dl/155490069/c7932d4/
http//hotfile.com/dl/165490070/c8745e7/

I have over 500 files to replace.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T13:35:24+00:00Added an answer on June 10, 2026 at 1:35 pm

    Since you must be using mysql for your wordpress database, you can do this replacement either by regex as you asked:

    Regex pattern : #http://(www.)?hotfile.com/\w+/\w+/\w+/#

    Replacement pattern: http//p.music.cdndomain.com/vod/music.folder/2010/

    An alternate simpler solution would be to extract the mp3 file name using simple string functions of mysql e.g.

    1. Use SUBSTRING or SUBSTRING_INDEX to extract file name of your mp3 file i.e. find the string after last occurence of “/” in your hotfiles url.

    2. Use CONCAT to append the file name retreived to new url prefix and update it in the database.

    Here is an example, you can appropriately change it for your database:

    mysql> select * from test_songs;
    +---------------------------------------------------------------+
    | song_url                                                      |
    +---------------------------------------------------------------+
    | http://hotfile.com/dl/157490069/c8732d4/mp3_file_name.mp3     |
    | http://www.hotfile.com/dl/123412312/dd732d4/mp3_song_name.mp3 |
    +---------------------------------------------------------------+
    

    Taking substrings:

    mysql> select SUBSTRING_INDEX(song_url,"/",-1) from test_songs;
    +----------------------------------+
    | SUBSTRING_INDEX(song_url,"/",-1) |
    +----------------------------------+
    | mp3_file_name.mp3                |
    | mp3_song_name.mp3                |
    +----------------------------------+
    2 rows in set (0.03 sec)
    

    Creating final update query:

    mysql> Update test_songs set song_url =
    CONCAT("http//p.music.cdndomain.com/vod/music.folder/2010/",
            SUBSTRING_INDEX(song_url,"/",-1)) ;
    Query OK, 2 rows affected (0.00 sec)
    Rows matched: 2  Changed: 2  Warnings: 0
    

    Checking the results :

    mysql> select * from test_songs;
    +---------------------------------------------------------------------+
    | song_url                                                            |
    +---------------------------------------------------------------------+
    | http//p.music.cdndomain.com/vod/music.folder/2010/mp3_file_name.mp3 |
    | http//p.music.cdndomain.com/vod/music.folder/2010/mp3_song_name.mp3 |
    +---------------------------------------------------------------------+
    2 rows in set (0.00 sec)
    

    Done !

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to do this regex match and replace but not able to
I'm trying to use regex to match a string that starts with a <p>
I'm trying to use a regex to match a pattern such as (letter(letter|number))* ,
I'm trying to match tags using preg_replace. The regex used is: <video[^>]*>(.*?)</video> But I'm
I'm trying to use regex to replace source attribute (could be image or any
I am working in VB.Net and trying to use Regex.Replace to format a string
trying to get a regex that will match a url e.g. 'http://www.test.com' and then
I am trying to write a gsub for a regex match, but I imagine
I trying to work out what regex will match filenames in quotes. Eg. blah
I am trying to write a regex to match pairs of cards (AA, KK,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.