Hello, I need to strip some span tags with a particular attribute, but leave the enclosed text intact.

For example:

<span class="someClass">Here's my text</span>

Replace with:

Here's my text

Thanks for any help you can offer.

Comments

mtndan’s picture

Category: support » bug

Ok I did managed to create a regex search and replace that seems to work:

Search:

<span class="recentChange">(.*)</span>

Replace:

\1

However the replace operation keeps timing out and I see this error in the logs:

preg_replace() [<a href='function.preg-replace'>function.preg-replace</a>]: Unknown modifier 'p' in c:\inetpub\acquia-drupal\sites\all\modules\contrib\scanner\scanner.module  on line 877.

Also, the replace action just deletes content out of the body field instead of replacing the match. Please help. Thanks!

aasarava’s picture

Your search term itself needs to be "regex safe". Try escaping your closing span tag like so: <\/span> .

LarsKramer’s picture

Be aware also that only the "greedy" quantifiers work with this module. Try something like this: http://drupal.org/node/534538#comment-1867648

Rhino’s picture

That's spam above isn't it? EDITED BY SILVERWING - spam removed

I have a search for images, where I want to remove all of them. I can search like this and get results;

http:\/\/domain.com\/images\*

but I don't get results if I include the <img src=" before the url, no matter how I escape it (or don't escape it).

Never mind, I can find things if i search <img src="http:\/\/ etc - doing something else wrong as it's the end .jpg"> which confuses things.

What I want to do: it's is the entire "img src" path I need to find and replace (not just the filepath to the image). I want to remove some images from nodes. (path is the same, image-name is different, and I'm sure all of you are familiar with the html <img src="blabla.jpg"> which needs to be removed with it.

damienmckenna’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

I am sorry, but we're not supporting the D6 version of the module anymore.