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
    (I'.


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

  2. "Christopher M." <> wrote in message
    news:...
    > 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 (I'.
    >
    >
    > W. Pooh (AKA Winnie P.)


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

  3. "Stuart McCall" <> wrote in message
    news:tieRr.526051$4...
    > "Christopher M." <> wrote in message
    > news:...
    >> 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 (I'.
    >>
    >>
    >> W. Pooh (AKA Winnie P.)

    >
    > Try putting the string into a temp variable, replacing the parens with "",
    > then do the replace on that.


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


    W. Pooh (AKA Winnie P.)
     
    Christopher M., Jul 31, 2012
    #3
  4. "Christopher M." <> wrote in message
    news:...
    > "Stuart McCall" <> wrote in message
    > news:tieRr.526051$4...
    >> "Christopher M." <> wrote in message
    >> news:...
    >>> 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 (I'.
    >>>
    >>>
    >>> W. Pooh (AKA Winnie P.)

    >>
    >> Try putting the string into a temp variable, replacing the parens with
    >> "", then do the replace on that.

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


    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
    #4
  5. "Stuart McCall" <> wrote in message
    news:g0_Rr.568787$4...
    > "Christopher M." <> wrote in message
    > news:...
    >> "Stuart McCall" <> wrote in message
    >> news:tieRr.526051$4...
    >>> "Christopher M." <> wrote in message
    >>> news:...
    >>>> 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 (I'.
    >>>>
    >>>>
    >>>> W. Pooh (AKA Winnie P.)
    >>>
    >>> Try putting the string into a temp variable, replacing the parens with
    >>> "", then do the replace on that.

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

    >
    > 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.


    That should do the trick. Thanks.


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

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.
Similar Threads
  1. Jim Bonacorda

    DISABLING THE REPLACE TAB IN FIND/REPLACE DIALOG

    Jim Bonacorda, Jul 9, 2003, in forum: Access VBA Modules
    Replies:
    1
    Views:
    140
    Dirk Goldgar
    Jul 9, 2003
  2. Katrina

    ignore warnings

    Katrina, Feb 18, 2004, in forum: Access VBA Modules
    Replies:
    5
    Views:
    95
    Guest
    Feb 25, 2004
  3. Adrian

    query problems with certain characters

    Adrian, Feb 25, 2004, in forum: Access VBA Modules
    Replies:
    1
    Views:
    104
    Wayne Morgan
    Feb 25, 2004
  4. MikeC

    Please ignore this post

    MikeC, Sep 26, 2004, in forum: Access VBA Modules
    Replies:
    2
    Views:
    108
  5. YisMan

    search but ignore some chars

    YisMan, Feb 21, 2006, in forum: Access VBA Modules
    Replies:
    7
    Views:
    127
    John Nurick
    Feb 22, 2006
  6. Fred Boer

    Replace certain characters in a string

    Fred Boer, Aug 15, 2006, in forum: Access VBA Modules
    Replies:
    3
    Views:
    135
    Fred Boer
    Aug 15, 2006
  7. Jim Burke in Novi

    function to replace multiple characters..

    Jim Burke in Novi, Apr 23, 2008, in forum: Access VBA Modules
    Replies:
    3
    Views:
    1,766
    Marshall Barton
    Apr 23, 2008
  8. Ann

    Display certain characters

    Ann, Nov 4, 2008, in forum: Access VBA Modules
    Replies:
    5
    Views:
    105
    Apprentice
    Nov 13, 2008
Loading...