Problems with matcher.find()

Hi,
Here is what I'm trying to do. Read one (or more later) files...one line at a time and compare it with a regular expresion to extract email addresses.
Here is my code:
public final class RegExpressions {
    private static String REGEX;
    private static String INPUT;
    private static BufferedReader br;
    private static Pattern pattern;
    private static Matcher matcher;
    private static boolean found, b;
public static void main(String[] args) throws Exception {
        initResources();
private static void initResources() {
       try {         
                  br = new BufferedReader(new FileReader("titleInfo.txt"));
       catch (FileNotFoundException fnfe) {
            System.out.println("Cannot locate input file! "+fnfe.getMessage());
            System.exit(0);
       try {           
            REGEX = "(((\\w)(.)*)+@)";
            INPUT = null ;
            INPUT = br.readLine();
            pattern = Pattern.compile(REGEX);
            while ((INPUT = br.readLine()) != null)
                 // Reset the matcher to begin its next match starting at
                 // the beginning of the newly-read line.
                 matcher.reset(INPUT);
                 matcher = pattern.matcher(INPUT);
                 // Search for a match. A Boolean true value returns if a
                 // match is found.
                 System.out.println("Current INPUT is: "+INPUT);
                 b = matcher.find();
                 System.out.println ("matcher.find() is: " +b);
                 if (matcher.find())
                      System.out.println (INPUT);
       } catch(IOException ioe){}
       catch(PatternSyntaxException pse) {
           System.out.println("There is a problem with the regular expression!");
           System.out.println("The pattern in question is: "+pse.getPattern());
           System.out.println("The description is: "+pse.getDescription());
           System.out.println("The message is: "+pse.getMessage());
           System.out.println("The index is: "+pse.getIndex());
           System.exit(0);
        System.out.println("Current REGEX is: "+REGEX);
        System.out.println("Current INPUT is: "+INPUT);
    }The file I read in looks like this:
Integration of Scheduling and Replication in Data Grids
Anirban Chakrti Depak R.A. Shuhis Supta
Software Engineering and Technology Laboratory
Something Something Ltd.
My City, Horse Road
Bangalore 560 100, India
Tel: 91 80 852 0261
Fax: 91 80 852 0740
{an_chakrti, depak_ra, shuhis_supta }@address.com
Now what happens is that matcher.find() never finishes executing. Meaning my programs gets stuck at that particular line. I tested with Print statements before and after...etc. Can anyone help me with this problem? Thanks

the only problem is that some of the emails do not contain the full names. For example if from the text below I extract the email addresses...
Reckoning Legislative Compliances with Service Oriented Architecture
� A Proposed Approach1
Naveen N. Kulkarni K M Senthil Kumar Dr. Srinivas Padmanabhuni
Software Engineering and Technology Labs, Infosys Technologies Ltd., Bangalore, India.
{naveen_kulkarni,senthil_km,srinivas_p}@infosys.com
....and I'm also able to tokenize them (into naveen and kulkarni for example). How do I use this information to extract the names, which have me mentioned earlier on in the text. The format in which the names are written is not the same. ie it differs from paper to paper. Here is the idea I had....
it seems that the first part of the email address always exists as it in the full name. If I used that in a regular expression...and went through the text file again trying to match that reg exp...that should work shouldn't it?
here is my attempt...doesn't work though....any ideas...or an explanation why my code doesn't work?
    private static void extractNames() {
       try {         
                  br = new BufferedReader(new FileReader("titleInfo.txt"));
       catch (FileNotFoundException fnfe) {
            System.out.println("Cannot locate input file! "+fnfe.getMessage());
            System.exit(0);
       try {           
            for (int i=0; i<emails.length;i++){
                 int index = emails.indexOf("_");
          if (emails[i].indexOf("_") != -1){
               StringBuffer firstName = new StringBuffer(temp.substring(0,index));
               REGEX = "((.)[ ])*"+firstName+"((.)[ ])";
          pattern = Pattern.compile(REGEX); // I get a null pointer exception on this line...?
     while ((INPUT = br.readLine()) != null )
               matcher = pattern.matcher(INPUT);
          System.out.println("Current INPUT is: "+INPUT);
          System.out.println ("Matche found? " +b);
          if (matcher.find()){
               System.out.println (INPUT);
               System.exit(0);
} catch(IOException ioe){}
catch(PatternSyntaxException pse) {
System.out.println("There is a problem with the regular expression!");
System.out.println("The pattern in question is: "+pse.getPattern());
System.out.println("The description is: "+pse.getDescription());
System.out.println("The message is: "+pse.getMessage());
System.out.println("The index is: "+pse.getIndex());
System.exit(0);
System.out.println("Current REGEX is: "+REGEX);
System.out.println("Current INPUT is: "+INPUT);
Thanks!

Similar Messages

  • Error while posting GR from EWM in ECC. "Problem with receiver finding"

    Hi
    I have completed putaway of inbound delivery in EWM. This has triggered PPF to ECC for GR posting. This is stuck in ECC SMQ2 with error "Problem with receiver finding".
    I have checked ECC>EWM interface configuration. Handling unit management setup in ECC and EWM. Do not see any issues there. Also tested GR account postings with IM storage location for Po in ECC. This is also working fine...so no issue with account determination.
    Unable to figure out what is causing issue. Please help. Thank you.
    Best Regards
    phani sai MN

    Hi All
    Thanks for your responses. Issue was with distrubution model fiter parameters. for message type InboundDelivery.Deliverychange there was additional filter parameter for logical system. Removed values for logical system and only retained warehouse number.
    With this issue is resolved. GR is posted succesfully in ECC.
    Best Regards
    Phani sai MN

  • Problem with the Finder window in Chrome

    Hello,
    I have a problem with my finder window in Chrome.
    Since the window isn't a separate window anymore, but stuck to the top of the webpage, my finder window is too big. I can't read the "Cancel" or "Send" (I have no idea what's supposed to be there in English but I assume it's something like "send" and "cancel") buttons. I have provided some images of the problem, even if I make the Chrome window as small as possible, the finder window still is too big for my screen. I can resize the finder window from lest to right, but not up or down, which is extremely irritating for me.
    If anyone can help me how I can solve this problem.
    Thanks!

    I found the solution on another thread...Here it is.
    "I was having the same problem.  I found a way to make it smaller.  First, I opened chrome and clicked the green button on the window to make chrome go into full screen.  Then I tried to save a file to make the finder window open in chrome. When it opened in full screen I could see the bottom of the window so I resized it to make it a little smaller.  Once I did this it remembered the size so now I can access the bottom buttons when I take it out of full screen mode. Hope this helps."
    Worked like a charm!

  • I have a problem with the finder

    Hi.
    I have a problem with the finder.
    My girlfriends Macbook (Yosemite 10.10) shows of 6 times in the finder. ?
    I can't find anything on her mac that tells me why this is. ?
    <Image Edited by Host to Remove Personal Information>

    Bugs and Fixes: What's with Yosemite renaming shared computers? | Macworld
    27" i7 iMac (Mid 2011) refurb, OS X Yo (10.10.1), Mavs, ML & SL, G4 450 MP w/10.5 & 9.2.2

  • Why can't I receive help with my problems with Match? A service I pay for??

    Why can't I receive help with my problems with Match? A service I pay for??

    Hi,
    THis is a user help forum. If you tell us what your issues are, maybe someone can offer advice. Otherwise, read this https://www.apple.com/uk/support/itunes/itunes-match/
    JIm

  • TS1702 problem with updated find my iPhone app: when I attempt to open the FMi app, it tells me that I need to be a registered developer and run iOS7 to do so; is anyone else having this problem?  I got the app as a regular update to my existing FMi app w

    problem with updated find my iPhone (FMi) app: when I attempt to open the FMi app, it tells me that I need to be a registered developer and run iOS7 to do so; is anyone else having this problem?  I got the app as a regular update to my existing FMi app which worked great.

    The problem is being reported in the news media, yes. Apparently someone at Apple jumped the gun and uploaded the update before it was ready. They'll probably issue another update shortly, I would expect, but you can go here:
    http://www.apple.com/support/itunes/contact/
    and follow the instructions to report the issue to the iTunes Store. If you have a backup copy of the older version of the app, remove the newer version, restore the old version to iTunes on your computer, and resync.
    Update: Well, that was certainly quick. As of a short time ago, various sites are reporting that the Find My iPhone app is no longer displaying the previous error message. If it still is for you, delete it from your iPhone and re-download from the iTunes Store.
    Regards.

  • Problem With Match Transformation

    Hi ,
    I am using Match transformation to find the duplicates .
    My input data like this
    EMP NO     ENAME         SAL     DEPTNO
    10     SRIRAM MV  10000     100
    11     MV SRIRAM  11000     100
    12     SRIRAM PV  11000     100
    13     SRIHARI       11000     100
    14     SUBBIAH       11000     100
    15     RAMANA       11000     100
    Iam finding the duplicates on Ename .
    My ename data like SRIRAM MV, MV SRIRAM  like that data . both are duplicate records . for that iam using WORD SIMILARITY  option instead of field similarity with match score is 100 and no match score is 99.
    But i am getting all are unique records .
    If i am using match score is 85 and no match  score is 84 then iam getting the result like this .
    EMP NO     ENAME     SAL     DEPTNO     GROUP_NUMBER     MATCH_STATUS     MATCH_SCORE
    11     MV SRIRAM     11000     100     1     P     94
    15     RAMANA     11000     100          U     
    13     SRIHARI     11000     100          U     
    10     SRIRAM MV     10000     100     1     D     
    12     SRIRAM PV     11000     100     1     P     88
    14     SUBBIAH     11000     100          U     
    means MV SRIRAM,SRIRAM MV ,SRIRAM PV  comes under one group number with SRIRAM MV  as driver and MV SRIRAM as passenger with 94 similarity score and  SRIRAM PV as passenger with 88 score.
    While i am using the match score i need to get 100% per SRIRAM MV and MV SRIRAM . then whats the settings needed to get correct result. whats the problem with my settings.
    Please help me out to solve the problem
    Thanks&Regards,
    Ramana.

    Ramana,
    <<< My ename data like SRIRAM MV, MV SRIRAM like that data . both are duplicate records . for that iam using WORD SIMILARITY option instead of field similarity with match score is 100 and no match score is 99. >>>
    You are looking for an exact match here, but MV SRIRAM and SRIRAM MV are not exactly the same.  The characters MV are in different positions.  The Word Similarity option compares words instead of the entire field, but the character position also affects the match score.
    <<< While i am using the match score i need to get 100% per SRIRAM MV and MV SRIRAM . >>>
    You cannot force the the match score to be a specific value.  SRIRAM MV and MV SRIRAM are not a 100% match and never will be.  What you need to do is adjust the match settings so that the dupe group includes SRIRAM MV and MV SRIRAM but excludes SRIRAM PV.  Try Match Score = 90 and No Match Score = 89.

  • Problem with Matching and Merging Step of MDM Workflow

    Hi,
    I have created a workflow which will first Match Step where the user will do both
    Matching and Merging. Then, it will go for a process step Final Review.
    Then, it will go for Branch step which is named as Decide on Check in.
    There are two workflow which are launched after this step.
    My workflow ran one time.
    The number of records is: 19585. The Match step which is assigned to a different user is not performing.
    It is a simple match based on First Name, Middle Name and Last Name.
    Any suggestion?
    Regards
    Kaushik Banerjee

    Hi Kaushik,
    What do you mean with "not Performing"? One suggestion, just log in with the 'Different User' who has been assigned for the matching task, and under that user goto the matching tab, in matching tab you will find a sub tab for Workflow, I hope you can work from there, If this doesnt solve your problem, then please let us know.
    Cheers,
    Cherry.
    Sorry problem with button;... so message came again... apologize.....
    Edited by: Cherry on Mar 23, 2009 9:42 PM

  • Problem with eclispe/find update

    Hi,
    My apology if it's not right place to talk about this.
    I get following error when I use Eclipse 3.1 find/update.
    Network connection problems encountered during search.
    Unable to access "http://update.eclipse.org/updates/3.0".
    Unable to access site: "http://update.eclipse.org/updates/3.0" [java.io.IOException]
    Unable to access site: "http://update.eclipse.org/updates/3.0" [java.io.IOException]
    I had this problem at my work then I thought it could be related to proxy setting. But I am having same problem at home as well. I dont have any proxy setting here..it's just connected via wireless network.
    I have tried using 3.1 update site as well by replacing 3.0 by 3.1 in above URL. It's been two days and I am yet to solve the problem.
    Please save me from this misery. :-(
    Thanks,
    Prabhat

    As this is a problem with Eclipse, the Eclipse support options would be the proper place to seek support.
    I found some info on this at https://bugs.eclipse.org/bugs/show_bug.cgi?id=105415 for details. Personally, I'd just update to the latest 3.2 milestone...

  • Problem with the finder

    I have a problem since a month with my finder. It reload every 5 minutes or something like that and it brings the finder to front so in example when i type in a text box in safari, it stops taping and it bring safari to the back and the finder menu bar is replacing it. So everytime i'm transfering a document to my extern hd and the finder is reloaded, it stop transfering and close every finder windows. Do you know what i can do with that? or do i need to go to a applestore and pay a new mac :(?

    Check for incompatible third party applications.
    [One person reports success|http://discussions.apple.com/message.jspa?messageID=8969672#8969672] with installing the latest version of Stuffit upgrade (13.0.3)
    [If using Stuffit, check this one first|http://discussions.apple.com/message.jspa?messageID=8884712#8884712]
    [Finder crashes associated with using Stuffit|http://discussions.apple.com/thread.jspa?threadID=1873700&tstart=0]
    [Finder crashing/looping/closing folders (Stuffit issue)|http://discussions.apple.com/thread.jspa?threadID=1882285&tstart=0]
    [Finder crashes associated with using Afloat|http://discussions.apple.com/message.jspa?messageID=8852780#8852780]
    [Quicktime 7.6 update issues with 3rd party software|http://www.macfixit.com/article.php?story=20090121223437550]

  • FBL5N : problem with Match-code

    Hi,
    In Tcode FBL5N i click on match-code of Customer Account's field to choose a Customer, in the first table (Customers by company code) when Ii click on one customer the list of customers is closed but i get nothing in Customer Account's field (it is empty)
    Please how to resolve this problem ?
    Regards.
    Edited by: jehade el aoumari on Jan 20, 2010 9:28 AM

    Hi ,
    I had the same issue with FBL1N and I managed to solve it.
    1. Open SE11
    2. Select radio button search Help
    3. Enter DEBI
    4. Click on change
    5. Choose Maint. in logon lang.
    6. Go to tab Included search help
    7. Select line DEBID
    8. Click on Param. assignment
    9. On the 1st line enter      KUNNR     C      KUNNR
    10. On the 2nd line enter   BUKRS     C      BUKRS
    11. Save
    This should solve your issue.
    Regards,
    Ben

  • Problem with "Remove find my iphone"

    Somone stole my iphone 4s and I used the remote procedure "find my iphone" but the device appeared offline. In any case, if it were connected to the internet I would come back a signal. The problem is that then I accidentally clicked "remove find my iphone" and therefore there aren't any more device, so I think that the thieves could use the device with no problem. There is no way to undo this?
    Ilaria

    ylaryna11 wrote:
    Somone stole my iphone 4s and I used the remote procedure "find my iphone" but the device appeared offline. In any case, if it were connected to the internet I would come back a signal. The problem is that then I accidentally clicked "remove find my iphone" and therefore there aren't any more device, so I think that the thieves could use the device with no problem. There is no way to undo this?
    No, you cannot undo it.

  • Having Problems with Location finder

    Since 4.0 update my location finder does not work on home network. Tried it on a public network and it works. Anybody else had this problem and did you find a solution.

    Many people (myself included) noticed that Location Services stopped working with the upgrade to iOS 4.0. The symptom is that Maps and other apps say "Your location could not be determined." even in areas that used to work. The problem is that starting in iOS 3.2 and iOS 4.0, Apple switched from using the SkyHook location database to using their own. Whereas the SkyHook database had the ability for users to add their own WiFi access points, Apple does not have anyway for us to do that.
    I just spent over an hour on the phone with Apple Support senior advisors, who initially wanted to restore my unit or even replace it (neither of which would have fixed it), until I found the news reports about Apples new location database. Eventually, I found a senior advisor who was able to track down the problem and admitted that, yes, since the switch from SkyHook to Apple's own database, many WiFi access points no longer work with location services. "Apple is working on the problem, and eventually it will be fixed, although there isn't any time estimate." I asked specifically if this meant that Apple was going to allow users to add their own WiFi access points, and she said "Yes."

  • Sound check / normalization problem with matched versus uploaded tracks

    I am finding that matched tracks are playing MUCH louder than uploaded tracks on my iPod.  Before I started the match process, my library was normalized to an 89 dB reference level, which USED to be the audio engineering standard for recordings.  The AAC tracks that Apple has matched my tracks with seem to be as much as 10 dB above this -- the difference is painful.  To make matters worse, iTunes Match usually only matches portions of albums, so some of the tracks (the uploaded ones) are playing back at a reference of 89dB while the matched tracks are playing back at whatever Apple uses (my guess is @98-100 dB).  My understanding of the MP3 file format is that there is no benefit to ripping to a 100 dB level. It is not like the old days of analogue tape where you could improve the signal-to-noise-ratio by recording slightly 'hot.' In an MP3 file, there is normalization information stored in the file header. I do not know about AAC files.
    I have turned 'sound check' on on my iPod, but it doesn't seem to make a difference.  Has anyone found a way to fix this issue short of renormalizing the entire library and then re-uploading verything to the Match service?  Needless to say, the original process of getting everything I owned to 89 dB was tedious in the first place and I don't want to have to redo that.  If I do need to redo everyhting, does anyone know what reference level Apple uses for its matched files?   

    @ roebeet.  Thanks for telling me that 'Sound Check' does not work in iOS 5.  That is what I had found, but it's good to know it's not just me.  I talked to an Apple tech support guy and he seemed to know nothing about this.  He had me hard reset my iPod and then wrote it up.  He was quite nice about it, and suggested I send a recomendation email to Apple.
    I downloaded a half dozen of Apple's matched AAC tracks from the iCloud and ran a volume check on them, and they seem to be using levels in the upper 90 dB range, so my guess that their tracks were a full 10 dB louder than my 89 dB tracks was confirmed.  What I've done to solve this is to remove all my uploaded MP3 tracks from the iCloud and from iTunes, renormalize them to 98 dB instead of 89 dB, then reimport them into iTunes and then reupload them to the iCloud.  It seems to be working so far.
    You are right about some of Apple's stuff being clipped.  You don't need Audacity, either: digital clipping sounds so very very ugly.  The Apple 256 kbs AAC version of 'Babe I'm Gonna Leave You' from Led Zepplin I is clipped.  There is no excuse for this.  It makes me wonder how to alter a file so that it won't be matched: my MP3 version of the song is fine.
    Thanks again for your help.

  • Problem with the Finder when copying stuff on a server

    Hi all !
    I have a NAS at home and since a few days, copying stuff on its hard drive has become a pain.
    The hard drives connected to the NAS mount well with no problem, and when I start copying a big file on them, The finder sort of freezes, becomes completely unresponsive.
    The console gives me informations like these :
    25/02/13 20:55:46,479 sandboxd[373]: ([356]) com.apple.qtkits(356) deny system-fsctl 0x7a13
    25/02/13 20:55:46,500 sandboxd[373]: ([356]) com.apple.qtkits(356) deny system-fsctl 0x7a13
    25/02/13 20:55:46,520 sandboxd[373]: ([356]) com.apple.qtkits(356) deny system-fsctl 0x7a13
    25/02/13 20:55:46,541 sandboxd[373]: ([356]) com.apple.qtkits(356) deny system-fsctl 0x7a13
    25/02/13 20:55:46,563 sandboxd[373]: ([356]) com.apple.qtkits(356) deny system-fsctl 0x7a13
    25/02/13 20:55:46,583 sandboxd[373]: ([356]) com.apple.qtkits(356) deny system-fsctl 0x7a13
    25/02/13 20:55:50,330 Locum[377]: Connection with distnoted server was invalidated
    25/02/13 20:55:51,308 com.apple.qtkitserver[356]: Failed to get user access for mount /Volumes/Disque dur
    25/02/13 20:55:51,312 com.apple.qtkitserver[356]: Failed to get user access for mount /Volumes/Disque dur
    25/02/13 20:55:51,316 com.apple.qtkitserver[356]: Failed to get user access for mount /Volumes/Disque dur
    25/02/13 20:55:51,422 sandboxd[373]: ([356]) com.apple.qtkits(356) deny system-fsctl 0x7a13
    25/02/13 20:55:51,442 sandboxd[373]: ([356]) com.apple.qtkits(356) deny system-fsctl 0x7a13
    25/02/13 20:55:51,463 sandboxd[373]: ([356]) com.apple.qtkits(356) deny system-fsctl 0x7a13
    25/02/13 20:56:08,589 Locum[378]: Connection with distnoted server was invalidated
    25/02/13 20:56:12,117 WindowServer[89]: CGXDisableUpdate: UI updates were forcibly disabled by application "Finder" for over 1.00 seconds. Server has re-enabled them.
    25/02/13 20:56:14,713 com.apple.usbmuxd[54]: _heartbeat_failed heartbeat detected detach for device 0x3-192.168.0.6:0!
    25/02/13 20:56:26,117 WindowServer[89]: disable_update_likely_unbalanced: UI updates still disabled by application "Finder" after 15.00 seconds (server forcibly re-enabled them after 1.00 seconds). Likely an unbalanced disableUpdate call.
    25/02/13 20:56:36,000 kernel[0]: utun_ctl_connect: creating interface utun0
    I have reformated the hard drive of the NAS, and its configuration is OK.
    On the mac, I have tried everything : Zapping the PRAM, repair authorisations, except reinstall the system. That i really dont want to have to do at the moment.
    So can anyone help with this ?
    Best regards,
    Phil.

    Exact same situation going on here. 
    Connecting to a NAS (DroboFS).  Started happening a few weeks ago.  I'm looking at a 1.19gb copy right now over a hardwired ethernet connection.  8.4 megs copied so far in 45 minutes. 
    os 10.8.4 Macbook Pro.
    Have tried SMB, AFP, using IP address, aliases, etc.  No noticiable difference.
    Used to be lighting fast, connection looks good, 1000T,... network speed tests look good, have looked at ip problems, everything looks good and nothing on my network changed.
    Only message in the system logs of relevance to the copy are:
    MacBook-Pro.local Locum[466]: Connection with distnoted server was invalidated
    MacBook-Pro.local WebProcess[467]: objc[467]: Object 0x7f9ebbc1c6c0 of class NSUserDefaults autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug

Maybe you are looking for

  • HELP NEEDED CAPTURE DV FOOTAGE WITH HDV VIDEO CAMERA

    I'm trying to capture DV video footage I've done years ago with my Sony DCR-HC40E PAl into FCP version 6. with my new camera HDV video Sony HDR-HC7 1080.i/mini dv so I can capture it into FCP but it's jerky, An yone know the setting for both the HDv

  • Can't send or receive SMS text

    Purchased a Curve on Tuesday and simply extended my current plan which includes texting. My Blackberry tells me I've sent SMS (check mark shows) but no one receives them, and I am not receiving their texts in return. Any help is greatly appreciated!

  • Error in invoking target 'nnfgt.o'

    Dear Experts, I'm upgrading my Oracle patch set 10.2.0.4 to 10.2.0.5. but while installing the patch set I'm getting the following error "NFO: Internal Error: Codeword file /opt/aCC/newconfig/aCC.cwd,/opt/aCC/newconfig/ansic.cwd missing or empty. INF

  • Could not give the message to the hub

    Hi everybody I have set up an adapter that publishes something, but I have currently no subscribers. This is on purpose since it is for a future extension. But the adapter keeps filling the logs with the messages: Could not give the message to the hu

  • Issue with purchase requisition for third party order (Item category S)

    Hello Experts,                      When I am trying to create purchase requisition with document type NB , item category S (third party) , I am nokt able to assign source of supply as contracts. That means when I click on the assign source of supply