• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Is there a known problem using preg_replace() within views ? Obviously, the function is used all over the place in the system.

I have a preg_replace that I have trialled in a php page without CI where it works fine. In the CI view for which it's intended, it does nothing. And I just don't know why!

The preg works on urls. Is that the issue ?

Here's the preg:

$pat ='/(^[a-z\/\.\:]*?sheet\/)(pub)([a-zA-Z0-9\=\?]*)(\&output;\=html)/';
$rep ='$1ccc$3#gid=0';

$theoriginal = preg_replace( $pat, $rep, $published );

Can someone suggest what may be wrong and any workarounds or solutions ?


There is zero reason why you can't use preg_replace anywhere in your application. You should verify that $published contains what you think it does.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.