[Phpwm] mysql search / replace

Phil Beynon phil at infolinkelectronics.co.uk
Mon Oct 8 12:44:38 BST 2007


> Have you tried:
>
> TRIM([{BOTH | LEADING | TRAILING} [remstr] FROM] str),
> TRIM([remstr FROM] str)
>
> Returns the string str with all remstr prefixes or suffixes
> removed. If none of the specifiers BOTH, LEADING, or TRAILING is
> given, BOTH is assumed. remstr is optional and, if not specified,
> spaces are removed.
>
> mysql> SELECT TRIM('  bar   ');
>         -> 'bar'
> mysql> SELECT TRIM(LEADING 'x' FROM 'xxxbarxxx');
>         -> 'barxxx'
> mysql> SELECT TRIM(BOTH 'x' FROM 'xxxbarxxx');
>         -> 'bar'
> mysql> SELECT TRIM(TRAILING 'xyz' FROM 'barxxyz');
>         -> 'barx'
> This function is multi-byte safe.
>
>
> Keith Pope
> Web Developer
>

Hi Keith,
No that won't work as its within the text and I don't want to remove all
spaces as such, just multiples of three.

The bit of text in the field looks like;

<div id="toplinks" align="left">
<a class="menubutton"
href="javascript:history.go(-1)">BACK&nbsp;&nbsp;&nbsp;   </a>
</div>

and it should look like;

<div id="toplinks" align="left">
<a class="menubutton"
href="javascript:history.go(-1)">BACK&nbsp;&nbsp;&nbsp;</a>
</div>

I know whay it happened - its one of these htmlentities going into a textbox
then getting re-encoded screwups.
What I can't seem to get though is a direct pattern match on three normal
spaces (as opposed to non breaking spaces), hence teh question as to if
there was a single char wildcard as against a '%' nlength wildcard.

P

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.488 / Virus Database: 269.14.4/1056 - Release Date: 07/10/2007
18:12


More information about the Phpwm mailing list