Results 1 to 7 of 7
  1. #1
    Star Lounger
    Join Date
    Dec 2003
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Field surrounded by brackets (2K)

    Conundrum of the day:
    I need to remove / hide a sequence field surrounded by brackets. When I search for ^d, the field gets found, just fine. But the particular field I want to find is surrounded by square brackets, like this: open square bracket{seq myField}close square bracket . When I search for open square bracket^dclose square bracket, which would distinguish the particular set of fields I want to hide, Word returns: ... Search item not found.

    Hints: Searches for open square bracket ^d find every instance of the field in question, but then I need to do a second pass and hide the trailing close square bracket.
    OTOH, searches for ^dclose square bracket returns: ... Search item not found. Furthermore, even in this forum, I can't get an opening and closing square bracket, and any text between them, to appear... (one wonders).

    OK Gurus, short of porting to UNIX and looking for a regular expression (square brackets and anything between them), how can I construct this search to work in one pass in word?


    NOTE: Since I cannot get square brackets to appear in this post either (some sort of HTML effect?) I designate square brackets as: open square bracket i.e. ASCII 91 and close square bracket i.e ASCII 93.

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Field surrounded by brackets (2K)

    This is a real puzzle as I can't work out why word won't find the field and you have already discovered what doesn't work.

    In Word we search for regular expressions by turning on Wildcards and then doing a search for something like <pre>[*]
    or
    [[0-9]]</pre>

    should have done the job but for some reason associated with the field code this is not working. Note: The square brackets are special characters when wildcards are turned on which is why you would need the backslash in front of them.

    The short answer is therefore - I have no idea how to do this in one pass with a regular search and replace but can do it by
    1. <LI>two passes
      <LI>converting the fields to hard coded text and then running a single pass
      <LI>writing a macro to do the job in a single action
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. #3
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Field surrounded by brackets (2K)

    Without using wildcards:
    Find: [^19 FieldNameEtc ^21]
    Replace: nothing

    Make sure that you include the spaces, before & after FieldNameEtc. in the Find box. Note: [^d FieldNameEtc. ^21] will also work in the Find box.
    Cheers,

  4. #4
    5 Star Lounger
    Join Date
    May 2001
    Location
    Stuttgart, Baden-W, Germany
    Posts
    931
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Field surrounded by brackets (2K)

    Wildcard searches are an utter, complete failure if it comes to fields.

    With [{ some field }], not even [? or ?] will match anything.

    <img src=/S/brickwall.gif border=0 alt=brickwall width=25 height=15> Klaus

  5. #5
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Field surrounded by brackets (2K)

    Well done Phil

    I would like to add this only works if you reveal the field codes first.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  6. #6
    Star Lounger
    Join Date
    Dec 2003
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Field surrounded by brackets (2K)

    I will add that searching for [^19 FieldName_Etc ^21] works at least 50% of the time for me (when it doesn't work, I reopen the Find dialog box, and retype the search string.

    But if I try that string in replace, where I'm replacing the present formatting (no format) with hidden, then my success rate goes from 50% with a work around to 0%.

    Some days it just doesn't pay to try. <img src=/S/bash.gif border=0 alt=bash width=35 height=39>

  7. #7
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Field surrounded by brackets (2K)

    Hmmm. Today I tried it again & it didn't work, with or without formatting properties. I kept building the expression & as soon as I added ^21 to the expression, it ceased to work. It's buggy, at best.

Posting Permissions

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