[SR-Users] PVs in Regular Expression Transformations

Juha Heinanen jh at tutpro.com
Mon Apr 12 18:14:44 CEST 2010


i tried to embed a PV in regex transformation, but didn't get desired
result.  is it possible or must regex only contain strings.

here is an example, where the idea is to strip string "456" from the end
of string "123456":

	$var(test) = "123456";
	$var(rest) = "456";
	$var(test) = $(var(test){re.subst,/^(.*)$var(rest)$/\1/});
	xlog("result is $var(test)\n");

unfortunately, the result is 0 rather than "123".

i also tried

$var(test) = $(var(test){re.subst,/^(.*)\$var(rest)$/\1/});

and

$var(test) = $(var(test){re.subst,/^(.*)$(var(rest))$/\1/});

but still 0.

-- juha







More information about the sr-users mailing list