Results 1 to 12 of 12
  1. #1
    Lounger
    Join Date
    Jan 2001
    Location
    Minneapolis, MN
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Wildcards & Replace?

    I'm currently using Word 2000 SR1-A, but my question goes back to my first experiences with Word 95.

    I found the wildcard search early on. I have a lot of experience in the DOS world, and was using some ports of Unix text editors. They included "regex-search-and-replace" - in other words, I could have wildcards in my search string, and there was a way to plug the matched text into my replace string. For example, I could turn "1234ABCD" into "Section: 1234 Subsection: ABCD".

    Anyone know of a way to do this in Word? It's a really neat feature if you're trying to turn various forms of raw data into more readable text. I've had other times I've wanted it, but I don't remember exactly what they were off-hand.

  2. #2
    susabelle
    Guest

    Re: Wildcards & Replace?

    You should be able to do something like this using the find and replace feature under edit. I'm assuming you tried it and it didn't work? Can you post an example of your document so we could play with it?

    -Susabelle

  3. #3
    Lounger
    Join Date
    Jan 2001
    Location
    Minneapolis, MN
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Wildcards & Replace?

    I don't have one handy - but I can reconstruct one type moderately easily:

    Turn:
    1234abcd
    3456lkjh
    7890oiuj
    7394next

    into:
    Cycle: 1234 Subnet: abcd
    Cycle: 3456 Subnet: lkjh
    Cycle: 7890 Subnet: oiuj
    Cycle: 7394 Subnet: next

    using only search and replace.

    I can FIND the eight character string - that's not a problem. But how do I break it up? (Yes I know I could pop it into Excel and use the fixed columns breakdown - but there are times when I'm not dealing with fixed columns. This is merely the easiest example I can produce off the top of my head.)

    As an overkill example, I could do this fairly easily in Epsilon, which was my DOS version of EMACS.

  4. #4
    susabelle
    Guest

    Re: Wildcards & Replace?

    Okay, this might take a couple of find-and-replace runs to make it work. First, find your 8-character string and replace it with a string that includes the first four, a character to denote the difference between the first four and the last four, and then the last four characters plus another character. So, if you had 1234abcd, you'd want to replace it with 1234 = abcd = or something along those lines. Once this is done throughout the document, you can then do a find and replace to replace 1234 = with Cycle: 1234. Do a third find and replace and replace ABCD = with Subnet: abcd.

    I've found with the find and replace that it sometimes takes a couple of runs at it to get what you want, but there is no easy way to do it in one pass. You also might consider building a macro to do the same thing, if you do it often.

    -Susabelle

  5. #5
    Lounger
    Join Date
    Jan 2001
    Location
    Minneapolis, MN
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Wildcards & Replace?

    But by the time I've done the search & replace for many (possibly pages) of nnnnaaaa strings, why bother? If I have to do one search & replace for each individual occurrence, I might as well just edit each one manually.

    It bugs me - in the Unix world, they've been able to do something like

    search for '([0-9][0-9][0-9][0-9])([a-z][a-z][a-z][a-z])'
    replace with 'Text #1, more text #2'

    and #1 gets replaced with the string matched by the first set of parenthesized stuff, and #2 with the second. If they've been able to do it for decades, it can't be _that_ difficult to code! So, why can't there be a similar search & replace in Word?

  6. #6
    susabelle
    Guest

    Re: Wildcards & Replace?

    Sorry I couldn't be of more help. As you're finding out, the MS world isn't the same as the real world...

    -Susabelle

  7. #7
    Lounger
    Join Date
    Jan 2001
    Location
    Minneapolis, MN
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Wildcards & Replace?

    I'm just hoping that SOMEONE found some magic that I've missed!

    I do PC software support for a living. I KNOW what MS software (in all it's infinite variations) is like.

    (which is why my vanity domain is running on a Linux box instead of WinNT box)

  8. #8
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Wildcards & Replace?

    Is there something in Woody's latest Tips which could help?
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  9. #9
    Lounger
    Join Date
    Jan 2001
    Location
    Minneapolis, MN
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Wildcards & Replace?

    Yes! Woody's Office Watch, Vol 4, Issue 52 had a write-up on it!

    And do you have _any_ idea how hard it was to find that write-up in the Help, even after I knew it existed?

  10. #10
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Wildcards & Replace?

    Hi,

    .Did that write-up solve your problem?

    .You can get to the archives by going to the main WOPR page, clicking on the "WOPR" icon, then clicking on the archives button (obviously you've found that now, but it's here for the record)
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

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

    Re: Wildcards & Replace?

    How about this
    Search for "([0-9]{4})([A-Z]{4})"
    Replace with "Section: 1 Subsection: 2"

    That works on your example
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  12. #12
    Lounger
    Join Date
    Jan 2001
    Location
    Minneapolis, MN
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Wildcards & Replace?

    Sorry if I was unclear.

    YES, it did solve my problem. Sufficiently so that I've been happily bouncing around the office the rest of the afternoon!

Posting Permissions

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