Results 1 to 2 of 2

Thread: regexp help for a tag

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2005
    Posts
    103

    regexp help for a tag

    I'm having trouble formulating a regular expression in a search (in Word VBA) to look for either an opening tag or a closing tag. I can get it to work for one or other but not both.

    I want it to be able to find the following tags in a document:

    <field: 1>
    <field: 2>
    <field: 143>
    <field: n>
    </field: 1>
    </field: 2>
    </field: 143>
    </field: n>

    It's the 'zero or one occurence of /' that's got me stuck.

  2. #2
    Frenzied Member DeadEyes's Avatar
    Join Date
    Jul 2002
    Posts
    1,196

    Re: regexp help for a tag

    + preceeding one or more times
    * preceeding zero or more times
    ? preceeding one or zero times
    try this
    Code:
    </?[^>]*>
    it will match anything between <...> and </...> and <../>
    including <!-- -->

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width