RegEx Replace Text -- strip leading and trailing spaces

Matt Denton matt.denton at limelight.com.au
Wed Apr 13 20:10:06 EDT 2005


Hi Wouter and Trevor

Thanks for the replies.  Yes Trevor, I had a similar line of code and I 
couldn't work out why it didn't strip the RHS whitespace.  Anyway I was 
using RegEx because I thought it would be faster, but how elegant is:

> get word 1 to -1 of pString

... thanks so much Wouter!

Trevor I'll keep your:

> get matchText(pString, "(?s)^[ \t\r\n]+(.*?)[ \t\r\n]+$", tReturnVal)

... tucked away, I'm still getting my head around RegEx and some of its 
peculiarities and really I just want to understand what I was doing 
wrong.  Plus I thought I'd get a speed improvement, looks like not.

Thanks again,

M@
Matt Denton  >  Limelight Media Pty Ltd  >  T 02] 9211 6622  >  F 02] 
9211 5922  >  ABN 72 065 014 280



More information about the use-livecode mailing list