HI Peter,
I'm using Virtuoso regexp_replace to strip newline and whitespace
characters from an xml file before passing it to xtree_doc.
My pattern to match is: '<n[0-9]:(\n|\s)'
I need to preserve the value matched by [0-9] in the replacement
string.
eg: regexp_replace(string,'<n3:(\n|\s)','n3:') as well as
regexp_replace(string,'<n5:(\n|\s)','n5:') and so forth for any
value of [0-9].
Is there a way to do this? In some regexp implementations parts of
the pattern can be tagged as a variable ( eg {$1} ) and passed to
the replacement string.
Yes, this is possible since Virtuoso, by using the following construct:
regexp_replace(string,'<n([0-9]):(\n|\s)','n\\1:')
Best regards,
Patrick