--- In [email protected], "brucexs" <[EMAIL PROTECTED]> wrote: > > > However, I'm not sure if it's worth the effort as I myself rarely use > > matchg function, > > I agree that matchg is probably not worth trying to support with a > separate syntax. > > I was thinking of > var["regexp"] > as a shortform for > regex.match(var, "regexp", ?"\0", "temp_var") > where the expression returns the result that regex puts in temp_var > (and PowerPro would take care of handling the temp_var internally); so > you could say thinks like > if (filepath["some regexp"]) do > statements to handle file paths matching > endif > > Also > var["regexp"] = "string" > for > regex.replace(var, "regexp", "string","var") > > In both cases, the regex integer return code would be placed in a > global variable _REGEX_ > > I don't use regular expressions much, but one problem with above is > there is no way to do replaceg, which I imagine would be a big hole. > > Right now, I cannot think of a clean way to do global replace (by > clean, I mean avoiding adding some new PowerPro syntax characters). > Any ideas? > > Another totally different approach would be to copy the Python syntax > using compiled re's, which should be possible as well, based on a > brief look. Any preferences? >
Personally I think replaceg/matchg should be the default one. I was once curious why PCRE didn't introduce switch g(lobal) like i(gnore-case), m(ulti-line), s(ingle-line). Some programs, like vim, have g switches. Anyway, I'm wondering may utilize the comment (?#...), though I don't know if it'll make any difference from introducing new syntax characters programmatically. E.g., prefixing (?#-g) at the start of the pattern: var["regexp"] = "string" for regex.replaceg(var, "regexp", "string","var") and var["(?#-g)regexp"] = "string" for regex.replace(var, "(?#-g)regexp", "string","var") which is essentially the same as, from the point of view of regex, regex.replace(var, "regexp", "string","var") As regards Python, I know nothing about it as I've never used it. However, I read that it doesn't support Atomic Grouping and Possessive Quantifiers, which seems a big minus to me as I often use Possessive Quantifiers to make regex fail faster. Sean ------------------------ Yahoo! Groups Sponsor --------------------~--> You can search right from your browser? It's easy and it's free. See how. http://us.click.yahoo.com/_7bhrC/NGxNAA/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/
