[Gambas-user] gb.pcre: RegExp.Replace() problem
Tobias Boege
taboege at ...626...
Sat Dec 20 09:27:32 CET 2014
Hi,
attached is a script which essentially executes
Print RegExp.Replace(" * * a *", "^[ ]*\\*", "'")
On my system the output is
'' a *
which I don't understand. As the regular expression indicates I want only
the one match at the beginning of the line to be replaced. Not the second
one behind it. The "a" acts like a border, to see if the "^" is completely
ignored -- but it isn't.
The error seems to come from
--8<-- [ trunk/gb.pcre/src/regexp.c ]---------------------------------------
389 r.subject = &subject[offset];
--8<------------------------------------------------------------------------
I guess that this should prevent recursive (indefinite) substitutions in the
replacement string... But if you ask me, the result of my script is wrong.
Regards,
Tobi
--
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
-------------- next part --------------
#!/usr/bin/gbs3
Use "gb.pcre"
Public Sub Main()
Print RegExp.Replace(" * * a *", "^[ ]*\\*", "'")
End
More information about the User
mailing list