Here's the preg_replace:
Code: Select all
$str = preg_replace("/@@\[((.|\n|\r\n)*?)\]@@/e","strlen('$1')-(substr_count('$1','\"')+1)",$str);Has anyone else run into anything like before? Can anyone suggest a relatively simple work around?
Here's an example of a shorter string that works:
Code: Select all
@@ї ]|ї@dtї<p>Bank of Scotland (Ireland) brings commercial banking services from the Scottish Highlands to the Emerald Isle. A member of HBOS, the bank provides a range of business banking services, including commercial loans, commercial and asset finance, and investment services. The bank operates from its headquarters in Dublin and regional offices in Limerick, Galway, Waterford, Cork, and Belfast. hen preg_replace tries to process too long of a string. The breaking point is around 14000 chars for my Linux system and around 20000 for my OS X box.
Here's the preg_replace:
[php]$str = preg_replace("/@@\[((.|\n|\r\n)*?)\]@@/e","strlen('$1')-(substr_count('$1','\"')+1)",$str);[/php]
The basic idea here is that I want to get a char count for everything between @@[ and ]@@ and replace that portion of the string with the count. It works fine on smaller strings, but breaks on sizes larger than those mentioned above.
Has anyone else run into anything like before? Can anyone suggest a relatively simple work around?
Here's an example of a shorter string that works:
[code]@@ї ]|ї@dtї<p>Bank of Scotland (Ireland) brings commercial banking services from the Scottish Highlands to the Emerald Isle. A member of HBOS, the bank provides a range of business banking services, including commercial loans, commercial and asset finance, and investment services. The bank operates from its headquarters in Dublin and regional offices in Limerick, Galway, Waterford, Cork, and Belfast. It has also been expanding operations as it aims to become the country's No. 1 bank. It agreed in early 2005 to purchase ESB's retail business, which includes 54 branches.</p>]dt@]|ї]@@[/code]
The longer string that br$str = preg_replace("/@@\[((.|\n|\r\n)*?)\]@@/e","strlen('$1')-(substr_count('$1','\"')+1)",$str);[/php]
The basic idea here is that I want to get a char count for everything between @@[ and ]@@ and replace that portion of the string with the count. It works fine on smaller strings, but breaks on sizes larger than those mentioned above.
Has anyone else run into anything like before? Can anyone suggest a relatively simple work around?
Here's an example of a shorter string that works:
[code]@@ї ]|ї@dtї<p>Bank of Scotland (Ireland) brings commercial banking services from the Scottish Highlands to the Emerald Isle. A member of HBOS, the bank provides a range of business banking services, including commercial loans, commercial and asset finance, and investment services. The bank operates from its headquarters in Dublin and regional offices in Limerick, Galway, Waterford, Cork, and Belfast. It has also been expanding operations as it aims to become the country's No. 1 bank. It agreed in early 2005 to purchase ESB's retail business, which includes 54 branches.</p>]dt@]|ї]@@Any help would be appreciated.
Thanks,
John