Replace, but ignore certain characters

Discussion in 'Access VBA Modules' started by Christopher M., Jul 29, 2012.

  1. I'd like to ignore certain characters when I use the replace function.

    For instance if I want to replace the phrase:

    'said I'

    in the phrase:

    'Jim said (I farted)'.

    In order to do this it seems that I have to ignore the parentheses in 'said

    W. Pooh (AKA Winnie P.)
    Christopher M., Jul 29, 2012
    1. Advertisements

  2. Try putting the string into a temp variable, replacing the parens with "",
    then do the replace on that.
    Stuart McCall, Jul 29, 2012
    1. Advertisements

  3. What I really want to do is ignore formatting, when I do a replace.

    W. Pooh (AKA Winnie P.)
    Christopher M., Jul 31, 2012
  4. Well presumably you know where the parens should appear in your replacement
    string, so once you've stripped them out and done your replace, put them
    back in.
    Stuart McCall, Aug 1, 2012
  5. That should do the trick. Thanks.

    W. Pooh (AKA Winnie P.)
    Christopher M., Aug 1, 2012
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.