View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tim Tim is offline
external usenet poster
 
Posts: 145
Default Regex techniques

You should be able to use Chr(10) or vblf/vbcrlf instead of \n.

Tim

"Dave Runyan" wrote in message
...
I am still struggling with the use of the RegExp object in the VBScript_55
library, in Excel/VBA.

In my "old" regex processor, BKReplacem, I could use special characters
such
as \n in the REPLACEMENT string, not just the search string. But that
does
not seem to work in VBScript... I would get the literal "\n" in the
output,
for example.

Perhaps I am trying to do things beyond this flavor of regex's
capabilities.
I am trying to substantially reform and add information to multiple HTML
docs, using a set of search and replace rules stored in a spreadsheet for
ease of maintenance.

I note that I have never seen a VBS-regex example involving multiple lines
of text, but isn't that why they have the multi-line and global options?

Does anyone know of a source of VBS-regex documentation or examples that
are
more oriented to text files, as opposed to field-validation applications?

I should mention that I am reading my text files in from a text stream
object into a single string variable, so that I can process the entire
scope
of the document - line by line will not suffice for what I need to do.

To recap my questions:
1. Can I use special regex characters in the VBS replace string?
2. Can I process entire multi-line documents, and if so is the one-string
approach the right one in VBS?
3. Is there a source of documentation on more substantial multi-line VBS
regexs?

Thanks!