Assigning RegExp backreferences to variables

A

Andy C.

Is there a way to keep backreferences from a regular expression after a
replacement operation is finished? I want to assign part of a match to a
variable. I'm using VBScript Regular Expressions 5.5 and Word 2000.

This page makes it look like you can access them with RegExp.$1, RegExp.$2,
etc., but the $ gives me an invalid character error.

http://msdn.microsoft.com/library/d...tml/reconintroductiontoregularexpressions.asp

Also, if there is a way to keep the backreferences, is it possible to keep
them using the Execute method rather than Replace?

I can think of workarounds for this, but I'm hoping for something more direct.

Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top