--- In [email protected], "brucexs" <[EMAIL PROTECTED]> wrote: > > > > > > Here is a working script that I believe does what you want. > > local sString, output > > sString="Hello [World]" > > win.debug(regex.replaceg(sString,?"\[.*\]","","output")) > > win.debug(output) > > > With some of the changes I have done for [] processing, it would be > fairly easy for me to allow the syntax > sString[ ?"\[.*\]" ] = "" > to replace above call to replaceg (but it would still be calling > regex under the covers). Is this worth doing?
It would be great to have it! > If so, should it call replaceg or replace as a default > (or is their a way to indicate this in the RE? There is a problem with replace(g)/match(g). The syntax is: local result_var ret_code=regex.replaceg(sString,patten,replace,"result_var") replace(g)/match(g) function returns (sort of) error-codes, not the resulting string/matches which is instead returned to the PP's (user-specified) variable result_var. In replaceg case, however, there is already a work-around, rg function. So, sString[patten] = replace could call regex.rg(sString,patten,replace) > Similarly > matched = sString[ ?"\[.*\]" ] This can be mostly done by: regex.matchg(sString,patten,?"\0"++_sep_,"matched") However, there is some arbitrariness around the _sep_ which separates the matched ones. Could it be user-defined one, like ",", "\r\n", etc, or should it be pre-defined one which then shouldn't be present in the matched ones? Sean ------------------------ Yahoo! Groups Sponsor --------------------~--> Home is just a click away. Make Yahoo! your home page now. http://us.click.yahoo.com/DHchtC/3FxNAA/yQLSAA/JV_rlB/TM --------------------------------------------------------------------~-> 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/
