Jump to content
Sign in to follow this  
microtronx

Delphi Rio and tRegEx.Replace Problem

Recommended Posts

Hi All,

 

does someone have also problems with Delphi Rio and tRegEx.Replace, it is the same as in following Rsp:

https://quality.embarcadero.com/browse/RSP-19902

 

I have installed all available patches and missing files for Rio but this problem still exists. Possible my Error and i don't see it? Same source works perfect with Delphi Tokyo 10.2.3:

 

function my_RegExReplace(const Match: TMatch): string;
var
	vbasic, vfunktion, vwert:string;
	vp1, vp2, vp3:string;
	i:integer;
begin
	result:=match.value;
	if match.value='' then exit;

	vfunktion:=copy(match.value,1,pos('(',match.value)-1);
	vwert:=copy(match.value, pos('(', match.value)+1, length(match.value));
	vwert:=copy(vwert,1,length(vwert)-1);

	if ansisametext(vfunktion, '.ResponseInfo.redirect') then result:='.ResponseInfo.redirect['+vwert+']';
end;

function my_RegEx_run_Replace(vScript, vBasicList, vBasicSuffix:string):string;
var
	vlist:tarray<string>;
	i:integer; vname:string;
begin
	result:=vScript;
	try
		vlist:=vbasiclist.split([',']);
		for i:=0 to length(vlist)-1 do begin
			vname:=trim(vlist[i]);
			if vname<>'' then begin
				if pos(lowercase(vname), lowercase(vScript))>0 then begin
					vScript:=tRegEx.Replace(vScript, vname+vBasicSuffix, my_RegExReplace, [roIgnoreCase, roMultiLine]);
				end;
			end;
		end;
		result:=vScript;
	finally
		setlength(vlist,0);
	end;
end;

function my_replace(vsearch:string):string;
begin
	// try something like this: vsearch :='xxx xxxxxx.Responseinfo.redirect(blablup); xxxxx';
	result:=my_RegEx_run_Replace(vsearch, '.S,.I,.O,.ResponseInfo.redirect', '((([^\(\)][,\-*\/])(([^\(\)]))[,*\-\/]*)+)');
end;

 

Share this post


Link to post

Please provide runnable code.  What is the expected result? What is the result you get?

 

Share this post


Link to post
17 hours ago, pyscripter said:

Please provide runnable code.  What is the expected result? What is the result you get?

 

Hi pyscripter, don't have time and ressources at the moment to create a demo from our code. We have switched back to Tokyo 10.2.3 and everything works again. If i have time next week, i will create a demo showing the problem in Rio. It seems that tRegEx is not working same as in tokyo!

Share this post


Link to post
On 1/17/2019 at 1:17 AM, microtronx said:

function my_RegExReplace(const Match: TMatch😞 string;

 

Certainly not executable code, you're using that function as input but never supply a TMatch parameter..

Share this post


Link to post
On 1/18/2019 at 6:22 PM, FredS said:

 

Certainly not executable code, you're using that function as input but never supply a TMatch parameter..

But that code works perfect with 10.2.3. In my_RegExReplace i do result:=match.value and only if i have to replace something special i change result to whatever i need, this is ok, AFAIK.

Share this post


Link to post
1 hour ago, Der schöne Günther said:

Can't you just provide a simple test case with code that actually compiles, your input and your expected result?

I've tried it today but with normal copy&paste of text the false offset in tMatch is not there, it is working. Only getting the text from tmyquery.fieldbyname('myclobfield').asstring forces the false offset in tRegEx.

I think it has something todo with the encoding of the text from am CLOB (UNI) field in ElevateDB. Possible that we've searched for problem in tRegEx but it is in combination with ElevateDB.

We're searching further. If we get a hit we'll post it here...

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×