Results 1 to 3 of 3
  1. #1
    nn12 is offline Member
    Join Date
    Sep 2008
    Posts
    85
    Rep Power
    0

    Default regex replace all ignore case

    How do I ignore case in the below example?

    Java Code:
    outText = inText.replaceAll(word, word.replaceAll(" ", "~"));
    E.g String inText="Retail banking Wikipedia, the free encyclopedia Retail banking From Wikipedia. retail banking industry."

    word=retail banking

    So outText should be "Retail~banking Wikipedia, the free encyclopedia Retail~banking From Wikipedia. retail~banking industry."

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,941
    Rep Power
    8

    Default

    Do it the long way: Pattern (Java Platform SE 6)
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,202
    Rep Power
    19

    Default

    Or embed the case-insensitive flag
    Java Code:
    (?i)
    db

Similar Threads

  1. Using regex to replace characters in a string
    By DC200 in forum New To Java
    Replies: 7
    Last Post: 10-13-2010, 02:35 PM
  2. Regex search and replace
    By joe robles in forum Advanced Java
    Replies: 1
    Last Post: 09-25-2010, 02:32 PM
  3. ignore backspace
    By Kyle227 in forum New To Java
    Replies: 6
    Last Post: 05-16-2010, 09:34 PM
  4. Can't make regex ignore line terminator
    By mobilityguy in forum New To Java
    Replies: 2
    Last Post: 03-11-2009, 04:27 PM

Posting Permissions

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