Scanner delimiter problems...

hey everyone,
I am attempting to read from a file using Scanner and wanted to change the delimiter so that it would read through the file and pick out the info I need.
However when i try
Scanner inputStream = new Scanner(new FileReader(file));
                inputStream.useDelimiter("\\n(), *[]");I get the following error after my program runs.
java.util.regex.PatternSyntaxException: Unclosed character class near index 8
\n(), *[]
^
(the carrot should be under the last bracket)
I think its because the parenthesis and brackets need to be expressed in a different way? I checked out the Pattern class but couldn't find anything with parenthesis. hoping you guys could help
Thanks in advance,
Tomek
Edited by: sstomek on May 4, 2008 3:55 PM

how can I escape those characters? Well even if i do not use the square brackets or parenthesis or asterisks, true the error does go away but my output is still not correct. Let me elaborate a bit. Here is an extended bit of my code...
Scanner inputStream = new Scanner(new FileReader(file));
                inputStream.useDelimiter("\\n\\s");
                if (inputStream.hasNextInt())
                    numVertices = inputStream.nextInt();
                System.out.println(numVertices);the beginning of the file I am reading from looks like this:
25
(934.39, 893.10)
(336.22, 622.56)
(205.64, 835.67)
(527.40, 188.27)
........and so on for 21 more lines
So the only information that is important to me is that first integer and then those double pairs. So I want the scanner to omit any spaces, commas, parenthesis, and brackets.
However my output is 0 instead of 25
-Tomek
Edited by: sstomek on May 4, 2008 4:32 PM
Edited by: sstomek on May 4, 2008 4:36 PM

Similar Messages

  • Problem with a regular expresion,for Scanner delimiter

    Hi,I'm having a problem I have a the following example text
    This is a simple #test with #lots of #sharps and normal text just for #testing #a #regular expression.
    also I have this regular expresion \\w*#\\w*
    the problem is that this regular expression as a delimiter in a Scanner class will read/parse only the words that dont have a +#+ as first char, the problem is that i need the exact opposite , i need to parse/read only the words that have a +#+ as first char.
    Thanks in advance.

    What you're trying to do is the opposite of what a Scanner is usually used for, but that's okay, because Scanner provides methods for that, too: Scanner sc = new Scanner(yourFile);
    String token = null;
    while ((token = sc.findWithinHorizon("#\\w+", 0) != null)
      System.out.println(token);
    } Passing zero as the second parameter means no horizon, i.e., find the next match no matter how far along it is. If you want to limit the search to the current line, you can use findInLine().

  • Scanner driver Problem with - Windows 8.1 and HP AIO L7680

    Hi folk,
    i have a problem with my HP AIO L7680.
    I have made an upgrade to Windows 8.1 x64
    I install the actual driver version 14.8.0.
    The printer runs but the scanner makes trouble.
    When i will start a scan process i will get an error message and the scan process will be canceled.
    I will get this error message with photoshop, HP Solution Center and any other scanner software.
    The HP Print and Scan Doctor says i should contact the support.
    Here i am any idea?
    By the way i disabled my Antivirus Software during the installation.
    Thanks a lot.
    greetings
    Markus
    This question was solved.
    View Solution.

    Hi Markus,
    I understand that you are having an issue with scanning after upgrading to Windows 8.1. I will try my best to help you resolve this issue. I just need a little more information. What operating system are you running on your computer? Are you connecting wireless or with a USB cable? What is the error message that you are getting?
    I am including this document for A 'No Scan Options' or 'Scan settings are not set' Message Displays on the All-in-One there are trouble shooting steps for Windows 8 that will work for Windows 8.1.
    I hope this helps, let me know.
    Thank you,
    I worked on behalf of HP.

  • Scanner software problem.

    HP wireless all-in-one CN245B
    Hi to everyone. I just bought this printer and I've got a problem with the scanner software.
    Can I scan all the document I want and after save them all together? From the sofware it seems that's possible, but when I do a new scan it delete the photo that it has already acquired. To keep it I must save it and then it closes the sofware, returning to the hp solution center.
    Please help me!
    Thank you.

    sorry, I put this in the wrong section, I'm new here!

  • 4400F scanner has problems with color slides

    About six years after buying the 4400F scanner, I finally opened it today in order to start scanning a lot of color slides going back more than 40 years.  It seems as if the software (or the scanner itself) doesn't know where one slide ends and the next one begins.  The slide holder accommodates up to four slides.  Using several methods of scanning permitted by the software, I obtain either three or five JPEG scans.  In the case of three, the images are properly centered--only the final one is missing.  In the case of five, the images are all off-center.  
    Has anyone had a similar problem with this unit and the software when scanning slides?
    EG 

    I've got a few years experience calibrating large format printers.  First, the Yellow sounds like a file problem.  I used to work with two workstations, one PC ( RIP station ), and one Mac ( file prep station ).  I tend to agree with you in that the OS is probably not the problem.  But, any Colorburst profiles should remain in the RIP, not in the originator application.  My workflow consisted of creating EPS files that were based on established color settings in their given applications ( i.e., Illustrator, Photoshop ) which were interpreted by the RIP which had it's own calibrated profile ( perhaps more than one based on how many different substrates were being used ).  Your partner may be complicating things by incorporating a RIP profile prematurely.  If there are deviations big enough to be noticed, there has to be something in the application color settings that is causing some type of corruption.  This could lead back to the operating system, but I would think it lies somewhere in Bridge or the application color settings.  Start there.  You should seriously consider implementing a calibration system if you do not have one already.  Another slight possibility is the driver's ability to interpret files coming out of Leopard vs. files coming out of Tiger.  It may benefit you both to be in the same operating system dynamics, using the same driver versions and RIP profiles.  At the very least, match everything that is currently working successfully and put them on both machines.  If there is still a noticeable problem in color matching, then something is seriously wrong and you should call in a prepress profiling expert.  Hope this helps.

  • Scanner Delimiter

    Im trying to read in a csv file, currently my delimiter is
    scan.useDelimiter(",");
    my problem is how do i get it to not include the start of the next line as part of the last token???

    The useDelimiter method accepts a regular expression, if I understand correctly. That means that newline is also a delimiter. Perhaps scan.useDelimiter("(,|\n)"); is closer to what you need?

  • Epson Scanner Selection Problem in Acrobat 9

    With the most recent update of Acrobat 8 as well as with Acrobat 9, when I try to create a pdf using my scanner, Acrobat does not recognize my Epson Perfection 3200 Photo scanner. I have the most recent version of the twain driver and Epson Scan utility (with works on my MacPro). Any suggestions of how to correct the problem?

    John said he was using the very latest Driver for his MacPro. Although the software work around might work for him.

  • Csv tab delimited problem

    HI Experts,
    I have a problem.
    I have uploaded the file in csv format using Open dataset.
    But they want in csv tab delimited format. I really dont understand how to do in this format.
    I know only csv (the file will be separated by ',') and if tab delimited means ( file separated by '#').
    How to achieve the csv tab delimited format.
    Also, in file, if the field contains - no value, it comes as space. But that space while concatenating, it is not added. How to acheive a space while concatenating the fields.
    Awaiting for your replies.
    Thans in Advance,
    Regards,
    Sakthi Sri.

    hi,
    DATA : FILENAME(128) DEFAULT '/usr/......../file.csv'. "" Your path in app server
    DATA : lv_str type string.
    data: l_seperator       TYPE c.       
      CLASS cl_abap_char_utilities DEFINITION LOAD.
      l_seperator = cl_abap_char_utilities=>horizontal_tab.
    OPEN DATASET FILENAME FOR OUTPUT IN TEXT MODE.
    CHECK sy-subrc EQ 0.
    loop at i_item.
        CONCATENATE
                    i_item-FIELD_1
                    i_item-FIELD_2
                    i_item-FIELD_3
                    i_item-FIELD_4
                    i_item-FIELD_5
                    into lv_str
                    SEPARATED BY  l_separator.
    transfer lv_str to filename.
    endloop.
    * Close File
    CLOSE DATASET FILENAME.
    regards,
    Siva Prasad

  • Epson Scanner connection problem

    I have used my Epson 2480 scanner for a few test scans and had no problems. Now all of a sudden the green power light is OFF but only when the USB cable is plugged in. If I unplug the USB cable the power light comes on. I have no idea what would cause this. I tried re-installing the software but that didn't do it. I tried plugging it into a powered Belkin USB hub and directly into my G5 dual 2.5 GHZ but there was no difference. Any suggestions?
    Thanks,
    -= Ken =-

    If available, plug it into another computer to see if you get the same results. Did your problem occur after updating to 10.4.4 and did you check http://www.epson.com for any updated drivers?
    ron

  • Regex help: Scanner delimiter that splits on commas if not in form (1,1)

    I have a scanner that reads in a LIST of commands:
    4=ATEXTSTRING(499,329)$3,5=ATEXTSTRING(342,3),8=SFDS(1,1)
    I want to have the scanner use the comma delimiter to get each of those three commands individually, but I dont want it to split on that comma in the coordinate.
    I've tried this:
    Scanner.useDelimiter("(?=,)((?!\\(\\d*,\\d*\\)).)*$");
    but that's just not working.
    It splits into:
    Starburst(200,200)$0,4
    Pentagon_Flight_Part1(200

    @OP: You could try something like this:
    String text = "4=ATEXTSTRING(499,329)$3,5=ATEXTSTRING(342,3),8=SFDS(1,1)";
    //coordinates can have a maximum of 5 digits:
    Scanner scan = new Scanner(text).useDelimiter("(?<!\\(\\d{1,5}),");
    while(scan.hasNext()) {
      System.out.println(scan.next());
    }

  • IT0009 bank detail delimiting problem!

    We have one employee who was terminated on Apr. 20th (which is the end of our payroll period). He has two IT0009 entries, subtype 0 for main bank. And subtype 1 is set up to deposit $300 per period.  Both entries are delimited on Apr. 20th.
    Now when we run payroll today, he got the $300 deposit but all other left amount was not sent to the main bank. The system created a carry-over for the left amount just like he doesn't have bank detail set up.
    So why subtype 1 entry works but subtype 0 entry doesn't ?? We never got this problem before. Any input is highly appreciated.
    Best regards,
    Johnson

    Hi Johnson,
    This problem had occured because the subtype for IT0009 by default would be 01 (Main Bank) and subtype 02 (Other Bank) can be used based on the senario of the client.
    You check both these infotype in PA30, under Direct Selection Column type 0009 in the infotype column,  click on the subtype and press F4. You can view both the subtype (01 and 02)
    Now when delimiting an employee's record through personnel action, both the subtypes in IT0009 has to be delimited.
    This should be a part of configuration in IMG/Personnel Administration/customizing Procedure/actions/define infogroup/infogroup (infogroup of Leaving / separation action) /
    here you need to add the subtype 02 under IT0009
    Now you can try running separation action again, both the subtypes will get delimited for the IT 0009.
    This will solve your problem...i guess
    regards,
    Santhosh

  • Mustek scanner connectivity problems

    I recently bought the much-maligned Mustek ScanExpress A3 USB. I am running Mavericks 10.9.5 on my iMac.
    After finding and installing the driver and ImageAcquire software, I thought I had solved all my problems.
    However, all I get is a "Scanner not connected to computer" error message when I attempt a scan.
    I have checked all the obvious signs (the scanner is plugged into power and to the computer by USB).
    Does anyone else have this issue? Mustek support is virtually nonexistent and I'd really like to use this scanner.

    Are you able to set the ImageAcquire software to launch in 32 bit mode?  I had some problems with my Canon scanner and software. It turned out that the scanner required the software to be in 32 bit mode.  I had to download and install the 32 bit version of the scanning software.

  • Brother DCP 7020 Scanner Driver Problem

    Hi,
    Hadn't used the scanner on my Brother DCP 7020 in 6 months and couldn't remember how to do scans. Called Brother Tech Support and they reminded me that the icon for scanning is in the Menu Bar at top of screen. For reasons not clear to me at the time they also suggested I delete the Control Center and scanner drivers and download the latest ones from the Brother site. Alas after I did this when I attempted to install the scanner drivers I got the error message "The chosen volumn contains software newer than the software you are attempting to install." The tech said to ignore the message and press continue so I did. When I continued with the installation process I got the message "There is nothing to install."
    The tech asked me to reboot but this did not solve the problem so he mumbled something about it being a Operating System problem and told me a higher level person would call me within 4 hours. You guessed it! nobody every called.
    Today I tried reloading the drivers that came with the printer but when the process was complete Control Center was nowhere to be found. I tried calling Brother Tech Support again but they never called back.
    Having no idea what the problem might be I tried Repairing Disk Permisions but that did not help. Next I booted from the original OS X disk and tried Repair Disk. The utility ran and said that there were "No repairs needed."
    Does anyone have any idea what's going on here and what I can do to fix things?
    Thanks,
    Winston
    After I did this he talked me through the install process

    Hi,
    Not sure I follow you. I downloaded the new drivers from the Brother site and when I went to install them I got the error message "nothing to install" or some such thing. Given that the dmg was on my desktop why would the computer not be able to "find" something to install?
    I found a thread on this site that said that many folks had printer problems soon after installing the 10.4.11 update and on checking back I found that I haven't used the scanner since I installed 10.4.11. Since the tech guys at Brother mumbled something about it being an operating system problem I am wondering if Apple screwed something up in the 10.4.11 update and is ignoring the problem because of the recent release of 10.5?
    Some folks on the other thread said that when they reverted back to 10.4.10 their printer problems went away so I'm wondering if that's what I should do to be able to reinstall the scanner drivers? Or are there worthwhile improvements on the 10.4.11 update that I should not throw away?
    Must say that as some one with a technical background (ex race care mechanic) I never cease to be amazed at how Apple, Brother, and other computer companies simply walk away from their problems rather than deal with them. If the folks at Ferrari tried that back when I was in racing old Enzo wouldn't have been too happy. Wonder why ole Bill and Steve don't seem to mind?
    All best,
    Winston

  • Scanner Recognition Problems

    I don't see any problems like mine posted, so I hope someone can help.
    I'm an artist (stop laughing) who's had this problem the past month.
    In a nutshell.
    My scanner (HP 3570c) ceased to work after a recent move. I got a window saying the computer couldn't find it. The System Profiler didn't show it nor did the scanner actually boot when plugged in. I replaced the scanner and upgraded to OSX tiger (from OS 9.2.2). Scanner works fine, but the Computer still couldn't find it.
    I did an Uninstall; Turned off Extensions; Checked with and applied all the manufacturer's troubleshooting standards (and I do mean all of 'em).
    The computer still couldn't find the scanner.
    Un/Reinstalled the software another 5 times, still no scanner.
    I have four questions.
    Am I missing some scanner prefs or extensions that may be corrupted?
    Is this where a PC card needs to be replaced?
    Will buying another scanner solve the problem?
    What am I missing?
    Thanks in advance
    J.Barwick

    For many jobs the digital camera works fine but when you
    need a scanner it really does a better job.
    Point. ADF fuction is a PITA to do with the camera.
    Scsi scanners and X are an exercise in making your
    head hurt imho.
    Oh, yea. Got tired of fighting with it, and could not find a decently priced 8x14 scanner....Thats why I switched to the camera
    If you have a legacy scsi scanner, use it in os9. 9 loves >scsi.
    True, and I still can dual boot If I really need to.
    It's all situational.
    The other reason I use the camera is my scanner is truely Legacy with a capital L....it is but 300dpi, and my camera is 2600...the PITA making a multipage is a trade off for the image quality.

  • CanoScan LiDE 60 scanner driver problems

    I'm usually pretty good at troubleshooting software issues on my iMac, but this scanner problem has me absolutely stumped!!! My old Canon CanoScan LiDE 60 scanner stopped working the other day...out of the blue. I have been using the ScanGear software without a hitch, and now every time I open the program, I get a "Failed To Open Driver" message. I figured out that I obviously needed to upgrade my software and drivers. I did some research online and was told I needed to install the new CanoScan software and driver from the Canon website. This scanner model is technically not supported by Snow Leopard, but some people got it to work!! Well...I tried that, followed all instructions correctly, then restarted my Imac and replugged my scanner USB cord. I opened the ScanGear software again, but I still have the missing driver message!! I've been trying several little tricks to get it work, but still nothing. I'm at the point where I need to start from scratch and uninstall everything related to the scanner, but I'm not sure how to do that correctly either, removing all the orphaned data! Can someone please give me a step-by-step process what I need to do?

    Guys, thanks for this. I've had similar problems but with your help and others solved both issues for the Toolbox and Driver (OS X10.6.8):
    Make sure all previous drivers downloads etc are deleted, inc the DMG files etc and disconnect the scanner.
    You can then download the latest Toolbox from the UK site [dated Feb 2011] (it doesn't require you to reboot, for some strange reason??). Then download the latest driver from the Australian site. You have to reboot then.
    Everything seems to work fine. No preview as before unfrotunately but goes a treat. Hope that helps guys.

Maybe you are looking for

  • QUESTION TO PAGES '09

    Hello, exuse my bad English, please! -> I'm from Germany But: I`ve got a important question to iWork`s Pages '09: How can I adjust that I can print the complete page (DIN A4)? Above are small arrows, which I unfortunately cannot shift however- Please

  • How do I move an action from one computer to another?

    I have created a rather complex action on my laptop computer, and I'd like to copy it and move it to my desktop machine. How can I do that?

  • Can no longer link to iTunes library on local net

    I've been using a 2011 Mini for my media server for about a year. It holds my iTunes library and has always worked fine. I often linked to it with my Macbook to have music in my home office. After upgrading both machines to Mavericks and iTunes 11.1.

  • Cisco chs435hdc Er04 001

    I have had Verizon Fios for a little over a month, and every so often upon turning on my new Cisco chs435hdc DVR and hitting the DVR button, an error message pops up saying Er04 001 and a countdown begins then the DVR turns itself off at the end of t

  • What is logical data base and how it is differfrom DDIC AND DATABASE

    HI , CAN ANY BODY HELP ME TO FIND THIS