[sr-dev] regex's as PVs in textops functions
Hugh Waite
hugh.waite at crocodile-rcs.com
Thu Jun 13 17:14:19 CEST 2013
Hello,
I need to run a text find-and-replace on the body of my requests and
responses. The texops functions 'replace_body_all' and 'subst_body' work
for fixed regular expressions, but mine need to be configurable i.e.
loaded from a database.
Trying to accept PVs in the regex parameter could intefere with regex's
that contain $ characters, so this isn't as simple as inserting the spve
fixup into these functions.
What do you think is the best way to implement this and remain
compatible with existing versions? New functions with different names?
For example:
route(FETCH_REGEX_FROM_DB);
if ($var(regex) != $null) {
replace_body_pv("$var(regex)", "$var(repl)");
}
Regards,
Hugh
--
Hugh Waite
Principal Design Engineer
Crocodile RCS Ltd.
More information about the sr-dev
mailing list