brucexs wrote:

>> As it's now, to avoid errors I'm forced to use
>> 
>> s[?/re1/]=""
>> if(not s)
> 
> Since you want result to be empty, I think you can use
> if (s)
> s[?/re1/]=""
> 

Yes, testing if(string) before substituting is more concise that jumping after 
the substitution, but my point 
is that if(string) has to be added before every string[regex]="" is used, 
because a priori you don't know 
what's in string. The error message doesn't make sense in this case, it is 
triggered because string (not 
regex) is empty. Would you trigger an error message in the following case?

local string=""
string=""

which I think is equivalent to string[regex]="" when of course regex isn't 
empty.

> This is just echoing the return code from regex plugin.  Maybe it is 
> a situation that most plugin users ignore?  I don't know the rules 
> of regex's:  is it correct to leave the string being scanned 
> unchanged if it or the regex is empty and not worry about the error 
> message?

IMO, if the string being scanned is empty, it will not match any regex, so it 
should be safe for powerpro 
to just not call the regex plugin and leave string unchanged.

If instead regex is empty powerpro (or plugin) should issue an error message.

A regex purist may object that an empty string matches ^$ and so
local s=""
s["^$"]="insert this into string"

should yield s=="insert this into string"

but we know that the regex plugin will puke on being passed an empty s, so 
PowerPro doesn't need to 
worry about this case, which is just a twisted version of s="this is how to set 
a string"



Attention: PowerPro's Web site has moved: http://www.ppro.org 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/power-pro/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to