Title: basehref error and preg_replace delimiter error
Last modified: August 22, 2016

---

# basehref error and preg_replace delimiter error

 *  Resolved [Peter Hardy-vanDoorn](https://wordpress.org/support/users/petervandoorn/)
 * (@petervandoorn)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/basehref-error-and-preg_replace-delimiter-error/)
 * Two things to report here.
 * 1. I’m finding that basehref replacement is limited as it is not picking up inline
   background image styles. EG: `<div style="background-image:url(/b392bd629.jpg);"
   >`.
 * 2. In attempting to get around this using the replace_query function, I’m getting
   an error from preg_replace: **Warning: preg_replace() [function.preg-replace]:
   Delimiter must not be alphanumeric or backslash in /html/wp-content/plugins/wp-
   web-scrapper/class.wpws.php on line 258**
 * Code I’m using is
 * `echo wpws_get_content('http://www.mysite.co.uk', '.tx1_ab1', array( 'replace_query'
   => 'url\(', 'replace_query_type' => 'regex', 'replace_with' => 'url(http://www.
   mysite.co.uk' ) )`
 * I believe that my regex is correct as I have tested it using 3 different sites:
   [http://www.phpliveregex.com/](http://www.phpliveregex.com/), [http://www.regexplanet.com/advanced/java/index.html](http://www.regexplanet.com/advanced/java/index.html)
   and [http://www.rubular.com/](http://www.rubular.com/)
 * Thanks
 * [https://wordpress.org/plugins/wp-web-scrapper/](https://wordpress.org/plugins/wp-web-scrapper/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [Peter Hardy-vanDoorn](https://wordpress.org/support/users/petervandoorn/)
 * (@petervandoorn)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/basehref-error-and-preg_replace-delimiter-error/#post-5517146)
 * Oops. Just realised that I’ve missed off the opening & closing / for the replace_query!
 * First point still stands though.
 *  Thread Starter [Peter Hardy-vanDoorn](https://wordpress.org/support/users/petervandoorn/)
 * (@petervandoorn)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/basehref-error-and-preg_replace-delimiter-error/#post-5517173)
 * More baseref woes.
 * The site I’m trying to scrape has images with `src="/v/nr/i/t.png"` but basehref
   is changing the url incorrectly. It’s changing it to `src="http://www.mysite.
   co.uk/nr/t.png"` – ie, it’s removing the `/v/` and `/i/` parts of the path!
 * It’s also doing the same with the `<a>` links – it’s removing the `/v/` from 
   the beginning of those too.
 *  Plugin Author [Akshay Raje](https://wordpress.org/support/users/akshay_raje/)
 * (@akshay_raje)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/basehref-error-and-preg_replace-delimiter-error/#post-5517312)
 * Try explicitly mentioning a basefref with the right URL rather than relying on
   the auto thing. And yes, it is limited to only src and href tags (not CSS)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘basehref error and preg_replace delimiter error’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-web-scrapper.svg)
 * [WP Web Scraper](https://wordpress.org/plugins/wp-web-scrapper/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-web-scrapper/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-web-scrapper/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-web-scrapper/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-web-scrapper/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-web-scrapper/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Akshay Raje](https://wordpress.org/support/users/akshay_raje/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/basehref-error-and-preg_replace-delimiter-error/#post-5517312)
 * Status: resolved