Re: RegEx Replace Text -- strip leading and trailing spaces

2005-04-14 Thread Matt Denton
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

Re: RegEx Replace Text -- strip leading and trailing spaces

2005-04-14 Thread ron barber
Hi Wouter On Apr 14, 2005, at 3:52 AM, Wouter wrote: On 14 Apr 2005, at 01:49, Ken Ray wrote: On 4/13/05 2:47 PM, "Trevor DeVore" <[EMAIL PROTECTED]> wrote: get matchText(pString, "(?s)^[ \t\r\n]+(.*?)[ \t\r\n]+$", tReturnVal) Wow, lots of things happen when sleeping :-). The matchtext version is

Re: RegEx Replace Text -- strip leading and trailing spaces

2005-04-14 Thread Wouter
Thanks Eric Regards, Wouter On 14 Apr 2005, at 10:54, Eric Chatonet wrote: Hi Wouter, Le 14 avr. 05, à 10:52, Wouter a écrit : The hard space if any, can be dealt with in a one time replacement by a soft space in the container to parse, out of the repeat loop. (is the non breaking space numtochar

Re: RegEx Replace Text -- strip leading and trailing spaces

2005-04-14 Thread Eric Chatonet
Hi Wouter, Le 14 avr. 05, à 10:52, Wouter a écrit : The hard space if any, can be dealt with in a one time replacement by a soft space in the container to parse, out of the repeat loop. (is the non breaking space numtochar(16)? On the mac this is mostly represented by a non-space character for

Re: RegEx Replace Text -- strip leading and trailing spaces

2005-04-14 Thread Wouter
On 14 Apr 2005, at 01:49, Ken Ray wrote: On 4/13/05 2:47 PM, "Trevor DeVore" <[EMAIL PROTECTED]> wrote: get matchText(pString, "(?s)^[ \t\r\n]+(.*?)[ \t\r\n]+$", tReturnVal) This will strip leading and trailing whitespace from a multiline string. But given that you say that word 1 to -1 is that mu

Re: RegEx Replace Text -- strip leading and trailing spaces

2005-04-13 Thread Ken Ray
On 4/13/05 7:22 PM, "Trevor DeVore" <[EMAIL PROTECTED]> wrote: > On Apr 13, 2005, at 4:49 PM, Ken Ray wrote: >> get matchText(pWhat, "(?s)^\s+(.*?)\s+$", tReturnVal) >> >> I agree that the "word 1 to -1" solution will do what you want 95+% of >> the >> time, but just wanted to make sure that ev

Re: RegEx Replace Text -- strip leading and trailing spaces

2005-04-13 Thread Trevor DeVore
On Apr 13, 2005, at 4:49 PM, Ken Ray wrote: get matchText(pWhat, "(?s)^\s+(.*?)\s+$", tReturnVal) I agree that the "word 1 to -1" solution will do what you want 95+% of the time, but just wanted to make sure that everyone knew there was at least one 'hole' in that approach in case anyone cared.

Re: RegEx Replace Text -- strip leading and trailing spaces

2005-04-13 Thread Ken Ray
On 4/13/05 2:47 PM, "Trevor DeVore" <[EMAIL PROTECTED]> wrote: > get matchText(pString, "(?s)^[ \t\r\n]+(.*?)[ \t\r\n]+$", tReturnVal) > > This will strip leading and trailing whitespace from a multiline > string. But given that you say that word 1 to -1 is that much faster I > am going to switc

Re: RegEx Replace Text -- strip leading and trailing spaces

2005-04-13 Thread Alex Tweedly
Trevor DeVore wrote: This will strip leading and trailing whitespace from a multiline string. But given that you say that word 1 to -1 is that much faster I am going to switch to that. Those of us still trying to break away from our previous languages like to complicate things on occasion ;)

Re: RegEx Replace Text -- strip leading and trailing spaces

2005-04-13 Thread J. Landman Gay
On 4/13/05 5:14 AM, Matt Denton wrote: I want a single RegEx expression using ReplaceText to strip out leading and tailing spaces, leaving any spaces in the middle untouched. For this particular case where you don't want to remove internal spacing, I like to use regular transcript: get word 1 t

Re: RegEx Replace Text -- strip leading and trailing spaces

2005-04-13 Thread Wouter
On 13 Apr 2005, at 21:47, Trevor DeVore wrote: snip Is there a way to do ltrim (trim whitespace on left of string) in plain transcript? Right now I just use: function str_lTrim pString get replaceText(pString, "^[ \t\r\n]+", "") return it end str_lTrim -- Trevor DeVore Blue Mang

Re: RegEx Replace Text -- strip leading and trailing spaces

2005-04-13 Thread Trevor DeVore
On Apr 13, 2005, at 12:25 PM, Wouter wrote: On 13 Apr 2005, at 18:09, Trevor DeVore wrote: I use this regex to strip whitespace: get replaceText(pString, "^[ \t\r\n]+|[ \t\r\n]+$", "") No offence, but this won't strip whitespaces at both ends of a string in one pass. And it is about ten times slo

Re: RegEx Replace Text -- strip leading and trailing spaces

2005-04-13 Thread Wouter
On 13 Apr 2005, at 18:09, Trevor DeVore wrote: On Apr 13, 2005, at 3:14 AM, Matt Denton wrote: G'day all Regular Expression syntax in ReplaceText is driving me a bit loopy right now, I was hoping someone out there could work out what I'm doing wrong... I want a single RegEx expression using Repl

Re: RegEx Replace Text -- strip leading and trailing spaces

2005-04-13 Thread Trevor DeVore
On Apr 13, 2005, at 3:14 AM, Matt Denton wrote: G'day all Regular Expression syntax in ReplaceText is driving me a bit loopy right now, I was hoping someone out there could work out what I'm doing wrong... I want a single RegEx expression using ReplaceText to strip out leading and tailing space

Re: RegEx Replace Text -- strip leading and trailing spaces

2005-04-13 Thread Wouter
And what about a one line non regex solution like: put word 1 to -1 of x into x? (I know, not as elegant and impressive as a true regex ;-) Gr W. On 13 Apr 2005, at 12:14, Matt Denton wrote: G'day all Regular Expression syntax in ReplaceText is driving me a bit loopy right now, I was hoping some

RegEx Replace Text -- strip leading and trailing spaces

2005-04-13 Thread Matt Denton
G'day all Regular Expression syntax in ReplaceText is driving me a bit loopy right now, I was hoping someone out there could work out what I'm doing wrong... I want a single RegEx expression using ReplaceText to strip out leading and tailing spaces, leaving any spaces in the middle untouched.