|
Re: [rfc] regex rewrite: msg#00024lang.smalltalk.gnu.general
Paolo Bonzini wrote: I was about to make the #copyReplacingRegex:with: methods use You mean so that you can use backreferences in the replacement string? Emphatically yes. I think that that it's what you want more often than not. Now, all that remains before this stuff can be made ``more'' official, I have written some tests as a way of exploring the code, but I have this query: CRegexRegisters >> #matchBeg and String >> #searchRegex: look like a failed match would return nil, but in practice, you get: | mr | mr := 'abc' searchRegex: '[0-9]+'. mr isNil printNl. "false" mr from printNl. "0". ! Is that intended? My preference is that a failed match should return nil. In some ways, though, always returning a RegexResult, with the additional methods #ifMatched:ifNotMatched: and #isMatched methods, is more elegant. I also think it would be more useful if =~ returned MatchResult/nil instead of true/false. After all, you can always write: (myString =~ '[A-Z][a-z]*') notNil Mike |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Smalltalk MUD: 00024, kraehe |
|---|---|
| Next by Date: | Re: Smalltalk MUD: 00024, kraehe |
| Previous by Thread: | [rfc] regex rewritei: 00024, Paolo Bonzini |
| Next by Thread: | Re: [rfc] regex rewrite: 00024, Mike Anderson |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |