Reading a String Literally - Finding the "\" Character with a Regex

How do I search for "\" characters in a string? Such as..
String text = "Temp\temp.txt";
The problem is that Java will read "\t" as a tab, so that
System.out.println(text);
Will return
Temp emp.txt
Also, searching for the regex "\\\\" will return a null result, presumably because Java interprets the "\t" as a tab character, not as a literal "\" followed by a literal "t".
How do I get Java to read the string without interpreting it?
Thanks in advance

Try also this:
public static void main(String[] args) {
          String test1 = "String with a\\t which is not a tab but a t preceeded with a \\ character";
          String test2 = "String with a \t which is a tab";
          System.out.println("This are the Strings as user sees / enters them:");
          System.out.println(test1);
          System.out.println(test2);
          System.out.println("");
          System.out.println("***********************************************************");
          System.out.println("");
          System.out
                    .println("Splitting first string using a \\\\\\\\ regex which will be interpreted by the regex engine as \\\\ which will represent a \'\\\' character:");
          System.out.println("");
          for (String s : test1.split("\\\\")) {
               System.out.println(s);
          System.out.println("");
          System.out.println("***********************************************************");
          System.out.println("");
          System.out.println("Splitting the second string just the same way:");
          System.out.println("");
          for (String s : test2.split("\\\\")) {
               System.out.println(s);
     }and read the console output.
It should be:
This are the Strings as user sees / enters them:
String with a\t which is not a tab but a t preceeded with a \ character
String with a       which is a tab
Splitting first string using a \\\\ regex which will be interpreted by the regex engine as \\ which will represent a '\' character:
String with a
t which is not a tab but a t preceeded with a
character
Splitting the second string just the same way:
String with a       which is a tab

Similar Messages

  • With the new software for the I phone it appears 12 000 mails without reading and I can't find the solution, With the new software for the I phone it appears 12 000 mails without reading and I can't find the solution

    With the new software for the I phone it appears 12 000 mails without reading and I can't find the solution, With the new software for the I phone it appears 12 000 mails without reading and I can't find the solution

    Actually your suggestions are the ones that i have tried. i have seen that you have tried to help others with this issue and the only one that i could find that said they found the problem said that it was an ilife update issue and it fixed it and i have no available updates. i know it has to do with something in photo stream because it happens when i create a new library and it is loading the photos but i get the message before i reach the maximum 1000 photos. so i've tried updating, new library(first backing up photos and then deleting them from iPhoto), reinstalling OSX many times, running disc utilities. I called Apple the first day i had this issue and i was the first person to call them for support with the retina display and i actually had it escalated to a senior advisor and we thought we fixed the problem but we did not. i am pretty fluent in dealing with troubleshooting these type of issues and this is the first time i'm reaching out to the community. i figured now that the retina has been out some time now that there would be an obvious answer to this issue. thanks for the quick reply.
    Bebers5

  • HT204382 I purchased icloud on my iPhone but i don't know how to coordinate with my macbook pro or add info like music.  Does all of my activity show up on both of the devices? Also how do I find the iphone with the macbook or ipad that I plan on purchasi

    I dont know how to use icloud on the mac book when I bought it on the phone..I need to know how to find the iphone with my mac book

    http://www.apple.com/iphone/icloud/

  • Hi Everyone.  I have an old Mac Book.  I have saved a ton of emails in my inbox 'On My Mac'.  There are so many it is slowing down my computer.  Where do I find the folder with all the emails so I can cut and paste them to an external hard drive?Pls.help.

    Hi Everyone.  I have an old Mac Book with software updated to 10.6.8.  I have saved a ton of emails in my inbox 'On My Mac'.  There are so many it is slowing down my computer.  Where do I find the folder with all the emails so I can cut and paste them to an external hard drive? Pls.help.  Tks.

    Depending on which email client software you use
    the files should be in 'your home folder' library, esp.
    if you use Mail application.... ~/Library/Mail
    Since you don't specify what mail application,
    that would most be associated with the file.
    I notice there are some items to the right of your post
    where it says "more like this' so that may be worth a
    look to see if similar issues were answered. Also, the
    Help viewer in your system is a searchable database.
    Seems that google also brings up fair information, too.
    Do you have a complete bootable clone of your entire
    Mac system on an externally enclosed hard disk drive?
    Good luck & happy computing!

  • Does anyone know what the file "memeodhelper is? It's preventing me from backing up my home directory. I can't even find the file with search. Hidden somehow?

    I would like to backup my Mac by copying my home directory to an external disk. When I try this, it always gets hung up on a file called "memeodhelper" saying I don't have permission to access the file and the paste stops. Can't find the file with a search. Any ideas?

    Hi Ray,
    Spotlight is no good for finding anything Apple thinks you don't need to find.
    You can "fix" that error...
    http://www.somewhereville.com/?tag=memeodhelper
    Or likely trash it...
    https://discussions.apple.com/message/11237019?messageID=11237019&tstart=0#11237 019?messageID=11237019&tstart=0
    Find Any File...
    http://apps.tempel.org/FindAnyFile/
    Hold Option or alt key when selecting Find to Find All.
    EasyFind...
    http://www.devon-technologies.com/download/
    Near the bottom of the page.

  • TS1424 there are 43 available apps' update  which couldn't be made with my current account. How i can find the account with which i bought them in order to update them

    there are 43 available apps' update  which couldn't be made with my current account. How i can find the account with which i bought them in order to update them

    Use get info in iTunes on your Mac.

  • I can't read acsm files on my e-reader after transferring them from the pc with ADE. it seems to work, but then when I try to open the files on the e-reader it says "open failure". what's wrong?

    I can't read acsm files on my e-reader after transferring them from the pc with ADE. it seems to work, but then when I try to open the files on the e-reader it says "open failure". what's wrong?

    The acsm file is not the book, it is a ticket to get the book.  I sometimes get library books online, here is what I do.
    1. Start ADE on the computer
    2. Go to library website and find the book I want to download.
    3. Click on the download link
    4. In windows 7 a box opens asking whether I want to open( or run) or save the acsm file
    5. Click open/run and ADE downloads the book into the "Library"
    6. Transfer the book (epub file) to the reader.

  • How do I find the screen with my personal iPod (my name's iPod) so I can download from my purchased or free songs/pods from my computer? My iPod has opened to that for 3 years and this week I can't find it: not on purchased page or on Apple store page.

    QUESTION from an American in India:
    How do I find the screen with my personal iPod (my name's iPod) so I can download from my purchased or free songs/pods from my computer? My iPod has opened to that for 3 years and this week I can't find it: not on purchased page or on Apple store page.

    See:
    Recovering your iTunes library from your iPod or iOS device: Apple Support Communities

  • How to replace the '&' character with '&' in xi

    Hi,
    i need to replace the '&' character with ' &'.but i f i am converting it is displaying as '&' because internally '&' = '&'.
    beacuse of this it is not converting.
    is there any possiblity to change the  standard conversion in xi.

    Graphical mapping does not support special character like & , <,> to be mapped.
    You can encode & as and in UTF-8 only.
    if you want the special character to be used, Opt XSLT mapping with ISO-8859-1 encoding
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" encoding="ISO-8859-1"/>
    <xsl:template match="/">
    <xsl:copy-of select="*" />
    </xsl:template>
    </xsl:stylesheet>
    How to Work with Character Encodings in Process Integration (NW7.0)
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/502991a2-45d9-2910-d99f-8aba5d79fb42

  • I am using iPhone 3GS. I am living in Saudi Arabia. I cannot find the directions with in GCC contries in the Navigation Application "COMPASS" of iphone. Can you please explain me how to work on it??

    I am using iPhone 3GS. I am living in Saudi Arabia. I cannot find the directions with in GCC contries in the Navigation Application "COMPASS" of iphone. Only the map is displayed. I am not gtting the directions or information when I use it. Can you please explain me how to work on it??

    See http://kb.mozillazine.org/Editing_configuration#How_to_edit_configuration_files
    Add code to [http://kb.mozillazine.org/UserChrome.css userChrome.css] below the @namespace line.
    <pre><nowiki>@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */
    #context-sendlink {display:none !important;}</nowiki></pre>
    See also http://kb.mozillazine.org/Chrome_element_names_and_IDs

  • How can I find the element with the closest value to a calculated "target value" in a 1D array?

    Hello all,
    may be the following question is very simple, but I am relatively new in labview and it would be great if somebody could help me:
    I have a acquaried 1D array of data-points. Now, I have to find the element in this array which value is the closest to a calculated "target value".
    After finding the element with the value close to the "target value", I have to get the position of this element (i.e. the index) in the 1D array.
    Now, I have to use this index to find and extract the element at this position in an other 1D array.
    It would be very nice if somebody could help me with this problem.
    Thank you,
    beam

    Find attached a sample vi that you can modify.
    Attachments:
    select_target_value.vi ‏22 KB

  • FindChildIndex cannot find the child with the given itemName

    Hi,
    I am getting error " findChildIndex cannot find the child with the given itemName" when runs the page from jdeveloper.
    I didnt use findChildIndex in my CO or AM.
    Please help me to resolve it.
    Thanks
    Amit Jaitly

    Amit
    Check old threads
    Re: how to call concurrent programs from oaf page
    http://forums.oracle.com/forums/search.jspa?threadID=&q=findChildIndex+cannot+find+the+child+with+the+given+itemName&objID=f210&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks
    AJ

  • I purchased an ipad for my husband in 12/2011 - it was stolen last night and i can't find the receipt with insurance and warranty

    I purchased an ipad for my husband in 12/2011 - it was stolen last night and i can't find the receipt with insurance and warranty.

    The warraty doesn't cover lost or stolen.
    If the iPad was running iOS 7, the thief/finder will not ever be able to use it.
    iCloud: Find My iPhone Activation Lock in iOS 7
    http://support.apple.com/kb/HT5818
    Apple (and no one else) can not assist (with serial number or iCloud) in finding a lost or stolen iPad.
    Report to police along with serial number. Change all your passwords.
    These links may be helpful.
    How to Track and Report Stolen iPad
    http://www.ipadastic.com/tutorials/how-to-track-and-report-stolen-ipadhttp://www.ipadastic.com/tutorials/how-to-track-and-report-stolen-ipad
    Reporting a lost or stolen Apple product
    http://support.apple.com/kb/ht2526
    What to do if your iOS device is lost or stolen
    http://support.apple.com/kb/HT5668
    iCloud: Locate your device on a map
    http://support.apple.com/kb/PH2698
    iCloud: Lost Mode - Lock and Trace
    http://support.apple.com/kb/PH2700
    iCloud: Remotely Erase your device
    http://support.apple.com/kb/PH2701
    Report Stolen iPad Tips and iPad Theft Prevention
    http://www.stolen-property.com/report-stolen-ipad.phphttp://www.stolen-property.com/report-stolen-ipad.php
    How to recover a lost or stolen iPad
    http://ipadhelp.com/ipad-help/how-to-recover-a-lost-or-stolen-ipad/
    How to Find a Stolen iPad
    http://www.ehow.com/how_7586429_stolen-ipad.htmlhttp://www.ehow.com/how_7586429_stolen-ipad.html
    What NOT to do if your iPhone or iPad is lost or stolen
    http://www.tomahaiku.com/what-not-to-do-if-your-iphone-or-ipad-lost-or-stolen/http://www.tomahaiku.com/what-not-to-do-if-your-iphone-or-ipad-lost-or-stolen/
    Apple Product Lost or Stolen
    http://sites.google.com/site/appleclubfhs/support/advice-and-articles/lost-or-st olen
    Oops! iForgot My New iPad On the Plane; Now What?
    http://online.wsj.com/article/SB10001424052702303459004577362194012634000.html
    If you don't know your lost/stolen iPad's serial number, use the instructions below. The S/N is also on the iPad's box.
    How to Find Your iPad Serial Number
    http://www.ipadastic.com/tutorials/how-to-find-your-ipad-serial-numberhttp://www.ipadastic.com/tutorials/how-to-find-your-ipad-serial-number
    iOS: How to find the serial number, IMEI, MEID, CDN, and ICCID number
    http://support.apple.com/kb/HT4061
     Cheers, Tom

  • I can't seem to find the bar with "file, edit, view, etc". I can view it if I press "alt", but when I hit any other key it disappears again. The back and forward arrow, house, refresh and "url" space is missing

    I can't seem to find the bar with "file, edit, view, etc". I can view it if I press "alt", but when I hit any other key it disappears again. The back and forward arrow, house, refresh and "url" space is missing

    * In Firefox 3.6 and later on Windows you can hide the "Menu Bar" via "View > Toolbars" or via the right-click context menu on a toolbar.
    * Press F10 or press and hold the Alt key down to bring up the "Menu Bar" temporarily.
    * Go to "View > Toolbars" or right-click the "Menu Bar" or press Alt+V T to select which toolbars to show or hide (click on an entry to toggle the state).
    See also:
    * [[Menu bar is missing]]
    * http://kb.mozillazine.org/Toolbar_customization

  • HT4812 I recently fixed my computer and need to reinstall logic pro 9 but I can't find the booklet with my serial number, is there any other way I can get the serial number for logic pro 9 (box)?

    I recently fixed my computer and need to reinstall logic pro 9 but I can't find the booklet with my serial number, is there any other way I can get the serial number for logic pro 9 (box)?

    If you still have the receipt or other proof of purchase, you can ask Apple to send you the serial. Otherwise, bad luck mate.. Good news is, you can now buy Logic Pro 9 from App Store for just 199 USD

Maybe you are looking for

  • Transfer a file from App Server to a FTP site.

    Hi, Abapers. I need your help. Probably, this topic has already been posted in a similar way, but we need an answer to solve our problem. We have to sent a PDF file from a directory of our app server (AIX) to a FTP directory... which would the FM seq

  • Windows Server 2008 R2 - You might not have permission to use this network resource. The request is not supported.

    Hello ! I have a server with Windows Server 2008 R2 (AD, File Server, DNS Server and DHCP Server) that not access network share other Domain Controller. Well, is very crazy. I view network shares by network computers and devices, but not \\domain_con

  • How to set where clause for a Valueset from OAF Page

    Hi all I am customizing a standard page Employee Self Service. I have added some additional fields to existing KFF. There was field say "CHILD NAME" which is a free text field. The client now wants it to be a Drop down(or as LOV) which should display

  • Pattern tool background fill

    Is there a way that the background fill of a pattern can fill the whole pattern so that there aren't gaps like the above picture? So that it woudn't matter if you expanded the border there would always be a solid fill background?

  • Layers in Cloned Frames

    I'm importing XML into a long Indesign CS3 document and cloning the frames according to anchored frames on a master page. How can I have layers in these cloned frames. When I try to make a frame a layer, it asks me to ungroup the frame that I want to