[fpc-pascal] Last fix for RegExpr (error on empty input)

Michael Van Canneyt michael at freepascal.org
Sat Feb 15 15:25:35 CET 2020



On Sat, 15 Feb 2020, AlexeyT via fpc-pascal wrote:

> 1) typo in new Id: iMput.

Indeed, I looked right over that. I fixed that.

>
> 2) wrong fix for 2nd "Error" call in Substitute(): you disabled Error 
> call but didn't disable Exit, you need to skip Exit there too, so 
> Substitute will return non empty result when user replaces regex "\b" to 
> e.g. "__".

I read your comment, but I am not sure that this is desirable behaviour.

For example sed also does not consider the empty string a word boundary:

home:~> echo '' | sed s/\\b/x/g

home:~> echo 'a' | sed s/\\b/x/g
xax

For empty string, it does not change anything. I think this is correct,
because there is no word, so there also cannot be a word boundary.

So I preferred not to change this behaviour.

Michael.


More information about the fpc-pascal mailing list