### Describe the bug

Axios is vulnerable to Regular Expression Denial of Service (ReDoS). When a manipulated string is provided as input to the format method, the regular expression exhibits a time complexity of O(n^2). Server becomes unable to provide normal service due to the excessive cost and time wasted in processing vulnerable regular expressions.

Please visit https://huntr.com/bounties/69a1aa07-c36e-4d9e-9325-b634e0aa4bb0/

### To Reproduce

_No response_

### Code snippet

```js
const axios = require('axios');

console.time('t1');
axios.defaults.baseURL = '/'.repeat(10000) + 'a/';
axios.get('/a').then(()=>{}).catch(()=>{});
console.timeEnd('t1');

console.time('t2');
axios.defaults.baseURL = '/'.repeat(100000) + 'a/';
axios.get('/a').then(()=>{}).catch(()=>{});
console.timeEnd('t2');


/* stdout
t1: 60.826ms
t2: 5.826s
*/
```


### Expected behavior

A regex optimization

### Axios Version

1.6.2

### Adapter Version

XHR/HTTP

### Browser

Chrome

### Browser Version

_No response_

### Node.js Version

20.10.0

### OS

Linux

### Additional Library Versions

_No response_

### Additional context/Screenshots

_No response_
test/specs/defaults.spec.js
describe('defaults', function () {
  const XSRF_COOKIE_NAME = 'CUSTOM-XSRF-TOKEN';
  beforeEach(function () {
    jasmine.Ajax.install();
  });
  afterEach(function () {
    jasmine.Ajax.uninstall();
    delete axios.defaults.baseURL;
    delete axios.defaults.headers.get['X-CUSTOM-HEADER'];
    delete axios.defaults.headers.post['X-CUSTOM-HEADER'];
    document.cookie = XSRF_COOKIE_NAME + '=;expires=' + new Date(Date.now() - 86400000).toGMTString();
  });
  it('should transform request json', function () {
    expect(defaults.transformRequest[0]({foo: 'bar'}, new AxiosHeaders())).toEqual('{"foo":"bar"}');
  });
  it("should also transform request json when 'Content-Type' is 'application/json'", function () {
    const headers = new AxiosHeaders({
      'Content-Type': 'application/json',
    });
    expect(defaults.transformRequest[0](JSON.stringify({ foo: 'bar' }), headers)).toEqual('{"foo":"bar"}');
    expect(defaults.transformRequest[0]([42, 43], headers)).toEqual('[42,43]');
    expect(defaults.transformRequest[0]('foo', headers)).toEqual('"foo"');
    expect(defaults.transformRequest[0](42, headers)).toEqual('42');
    expect(defaults.transformRequest[0](true, headers)).toEqual('true');
    expect(defaults.transformRequest[0](false, headers)).toEqual('false');
    expect(defaults.transformRequest[0](null, headers)).toEqual('null');
  });
  it("should transform the plain data object to a FormData instance 'Content-Type' if header is 'multipart/form-data'", function() {
    const headers = new AxiosHeaders({
      'Content-Type': 'multipart/form-data'