RegEx - my personal illogical nightmare 
Author Message
 RegEx - my personal illogical nightmare

H'ye,

I'm stuck. I am using Word97 (where apparently RegEx is NOT RegEx as
we used to know them...).

What I want to achieve:

Find a single asterisk (*) in the document and have it formatted and
aligned like that:

texttexttexttexttext
texttexttexttexttext

         *

texttexttexttexttext
texttexttexttexttext

What I already got (or not, who knows) is the first part: Find the
asterisk and insert the empty lines (or, if there are more lines
before or after, delete them).

  With ActiveDocument.Content.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "([!^13])^13{1;}\*^13{1;}([!^13])"
    .Replacement.Text = "\1^13^13*^13^13\2"
    .MatchWildcards = True
    .Execute Replace:=wdReplaceAll
  End With

Showing as here:

texttexttexttexttext
texttexttexttexttext

*

texttexttexttexttext
texttexttexttexttext

But I can't get the second part (the center alignment) working.
I have found out that it's probably the way I replace the ^13.

  Call ClearFindAndReplaceParameters

  With ActiveDocument.Content.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Replacement.ParagraphFormat.Alignment = wdAlignParagraphCenter
    .Text = "^13\*^13{2}"
    .Replacement.Text = "^13*^13^13"
    .MatchWildcards = True
    .Execute Replace:=wdReplaceAll
  End With

This not only aligns the wanted ^13*^13^13, but the preceding and the
following lines as well. Hmpf.

I've read on the MVPS site that I must not use the ^13 in the replace
string, but instead ^p. But this gets me the error 5624. I CAN'T use
^p. - Or can I?

As said, I'm using Word97.
And as said, I'm stuck. :-]

See ya
Peter



Wed, 24 Nov 2004 12:33:20 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. RegEx - sorry to bother - found the solution

2. Using Regex to get a block of text

3. RegEx Capturing

4. How to split URL without http:// using RegEx?

5. Help with Regex.Replace pls...

6. RegEx Count

7. More RegEx III

8. More RegEx (Numbers with Commas)

9. RegEx

10. RegEx US State Abbr. Validation Prob

11. RegEx question

12. REGEX, groups and matching

 

 
Powered by phpBB® Forum Software