[plug] Stripping out Markups in SQL

Trevor Phillips T.Phillips at murdoch.edu.au
Fri Aug 30 17:22:56 WST 2002


On Friday 30 August 2002 14:34, Trevor Phillips wrote:
> 
> What I currently have is:
>    IF(LOCATE('<',RESOURCE.TITLE,1)=1 &&
> LOCATE('>',RESOURCE.TITLE,1)>0,SUBSTRING(RESOURCE.TITLE,LOCATE('>',RE
>SOURCE.TITLE,1)+1),RESOURCE.TITLE)
>
> This only works if the Markup is at the start of the string, though...
> I could toy with using both locate positions  to chop out the middle bit,
> but, ugh! It's getting messy. ^_^
>
> And yet, all I want to do is the equivalent of the perl:  s/\<.*?\>//gs;

I sort of found an acceptable solution, using INSERT, to basically "insert" 
over a range within the text, a nice blank value:
  IF(LOCATE('<',RESOURCE.TITLE,1)>0 && LOCATE('>',RESOURCE.TITLE,1)>0,
    INSERT(RESOURCE.TITLE,
      LOCATE('<',RESOURCE.TITLE,1),
      LOCATE('>',RESOURCE.TITLE,1)-LOCATE('<',RESOURCE.TITLE,1)+1,''),
    RESOURCE.TITLE)

All this just to have a nice list in order in SQL. *sigh*

-- 
. Trevor Phillips             -           http://jurai.murdoch.edu.au/ . 
: Web Technical Administrator     -          T.Phillips at murdoch.edu.au : 
| IT Services                        -              Murdoch University | 
 >--------------------------------------------------------------------<
| On nights such as this, evil deeds are done. And good deeds, of     /
| course. But mostly evil, on the whole.                             /
 \      -- (Terry Pratchett, Wyrd Sisters)                          /



More information about the plug mailing list