/    Sign up×
Community /Pin to ProfileBookmark

preg_replace working fine on one server, not on another

I have a few preg_replace functions that are working fine on my local test server but not at all on my production server (everything just passes through unchanged.

The first is to convert <span> tags to a different tag, and it goes like this:

[code=php]$post_content = preg_replace(‘|<span class=”(.*)”>(.*)</span>|eis’,'<pstyle:$1>$2<pstyle:Body Text>’,$string);[/code]

On my test server, it takes something like

[CODE]<span class=”test”>this is test text</span>[/CODE]

and turns it into

[CODE]<pstyle:test>this is test text<pstyle:Body Text>[/CODE]

but on my production server it changes nothing.

The next one is to strip out everything between two span tags, and it goes like this:

[code=php]$post_content = preg_replace(‘|<span class=”writely-comment(.*)”>(.*)</span>|eis’,”,$post_content);[/code]

Any thoughts?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@kudzugazetteauthorSep 17.2010 — Is it possible this is a server configuration issue that could be changed?
Copy linkTweet thisAlerts:
@NogDogSep 18.2010 — I don't know why it would be different. One thing I might try is removing the "e" modifier, as it seems superfluous here. (Again, I don't know why that would matter, but it's probably what I'd try next. ? )
×

Success!

Help @kudzugazette spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.6,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...