Regexp and group capturing

Hi,
I 've trouble with capturing group as mention in the example below
String s = "KLASSE3";
Pattern p = Pattern.compile("KLASSE(\\d)");
Matcher m= p.matcher(s);
System.out.println( m.groupCount());
System.out.println( m.group(1));
Running this gives :
1
Exception in thread "main" java.lang.IllegalStateException: No match found
at java.util.regex.Matcher.group(Matcher.java:421)
Tried with 1.5.0_08 and 1.6.0-b105
Thanks for any hint

shame on me !!!
thanks very much dude

Similar Messages

  • RegExp and group

    Hi I'm currently working on an IDL compiler and was wondering if somebody can help me with a regular expression I use to read out methods from an IDL file.
    this.methodPattern = Pattern.compile("\\s*" +
         "(\\w+)" +
         "\\s+(\\w+)\\s*" +
         "[\\(]\\s*" +
         "(?:(?:\\s*?(\\w+)\\s*(\\w+)\\s*?[,]?)?)*" +
         "[\\)]" +
         "\\s*(?:\\s*raises\\s*(\\w+))?;");
    Now this is supposed to match something like
    String abc(int a, int b, int c) raises RemoteException
    which it does :)
    The problem lies with the '+' quantifier which overwrites my parameters, now it only stores the last parameter in this case it would store:
    group(i) -> int
    group(i+1) -> c
    The problem only lies in the highlighted part of the code, the rest is matched and stored properly.
    it overwrites the previous parameters, is there a way to store all parameters instead of only the last one? I thought the + quantifier wouldn't cause issues like that.
    I'm using JRE 1.6
    If someone has an idea as to what I can do in this situation I would be most grateful for suggestions.
    - I know I could just match the whole contents and the split the String into an Array, however I would prefer to keep it to one Pattern.

    You probably want a compiler generator like
    ANTLR or
    JavaCC.Note that JavaCC has an IDL grammar; you can get it here:
    https://javacc.dev.java.net/servlets/ProjectDocumentList?folderID=110&expandFolder=110&folderID=0
    To use it, download it and do something like this:
    $ cat Hello.idl
    module HelloApp
    interface HelloCallback
       void callback(in string message);
    interface Hello
       string sayHello(in HelloCallback objRef, in string message);
    $ javacc IDL.jj && javac *.java && java IDLParser Hello.idl
    Java Compiler Compiler Version 4.0 (Parser Generator)
    (type "javacc" with no arguments for help)
    Reading from file IDL.jj . . .
    File "TokenMgrError.java" does not exist.  Will create one.
    File "ParseException.java" does not exist.  Will create one.
    File "Token.java" does not exist.  Will create one.
    File "SimpleCharStream.java" does not exist.  Will create one.
    Parser generated successfully.
    Note: IDLParser.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    IDL Parser Version 0.1:  Reading from file Hello.idl . . .
    IDL Parser Version 0.1:  IDL definitions parsed successfully.You can either add syntactic actions to collect the method names or convert this to a JJTree grammar and use a Visitor; the latter is the cleaner technique but the former may be a bit simpler.

  • How to integrate operating charts of account to country and group coa

    Hi Sap gurus,
    How to integrate operating chart of account to country and group chart of account
    Regards,
    Rajesh

    First create the country chart in OB13 and assign the same to OB62.
    Then for each operational chart of account, enter the country chart of account in FS00 and this will be captured in field Alternate account number.
    The relationship between operational to country chart of a/c is 1:1.

  • SNMPv3 user and group dependency?

    HI,
    if i create group with authpriv and user with no authnopriv, and if we add user to this group. what will be result? this user will be authenticated or not? what is the dependency between users and groups ? Which has high priority?
    thanks guys

    Hi. Before I found this answer and the link Vinod Arya provided, I had the same question, so I did some tests in GNS3 configuring different snmpv3 groups within a router cisco 2800 (i.e. a no-auth group, an auth group and a priv group); creating different users with different security levels  and making all the possible combinations between users and groups. After capturing with Wireshark those results (i'll put them at the end of the question) I write a "rule", the "general conclusion" of that dependency between the security level of groups and users, as follows:
    - " Within the agent, the group's security level has precedence over the user's security level member of that group, if the group's security level is greater than the user's security level. This is explained with the following two scenarios. First scenario, If inside the agent, the group which the user belongs, does not have any securities (a noauth group) and the user inside of it has a security level greater, for example, authPriv; an external incoming request to the user of this agent, with authNoPriv security level, will be able to gather the information that was looking for, despite the user inside router's agent has configured both authentication and privacy protocols and keys. Second scenario, the opposite situation. When the group's security level is higher, for example authPriv and the user within the group has a lower security level (for example, a noAuthNoPriv user or a authNoPriv user)  an external incoming request to the user of this agent, with noAuthNoPriv or authNoPriv security level, will get a NULL response to the request.
    That's why concordance must exist between the security level of both the group and the users members of that group.
    Another important consideration is consider the interaction between user's security levels (admin and agents). The security level of the user has precedence over the request's security level of the admin console, because if the security level of the incoming request is higher than the configured for the user who it is asking to, the request won't be successfull and an error message "unsupported security level" will be sent to the admin console."  -
    Please I want to know if the conclusion I reached after the analisis of the results of tests is correct, or if it's imprecise, you can help me to improve it.
    In the link it doesn't say literally that the group has precedence, it mentions about the errors in the case of a missing password or inconsistence between group and user's security level. Also saying that the group's security level has precedence over the user's security level is not always true wich I think was demonstrated with the first scenario example, that's why I need to know if the explanation I wrote is good or is missing something.  Thanks in advance
    Results of the tests: the image provided

  • What is difference between distribution list and share point group? Can we add distribution list into person and group column of share point list?

    what is difference between distribution list and share point group? Can we add distribution list into person and group column of share point list?

    there is a workaround you can try, create audience and add DL to them and deal with the audience or convert DL to groups
    https://social.technet.microsoft.com/Forums/en-US/02f0d773-8188-4d94-a448-0c04d838b0cf/distribution-lists-in-sharepoint?forum=sharepointgenerallegacy
    Kind Regards,
    John Naguib
    Technical Consultant/Architect
    MCITP, MCPD, MCTS, MCT, TOGAF 9 Foundation
    Please remember to mark your question as answered if this solves your problem

  • Partition Name in Select and Group-By

    Is there a function that returns the partition name a row is stored in? I'd like to use it in a SELECT statement, if it exists.
    The goal is to get row counts per partition to determine skew on a hash-based partition (otherwise, I'd just select and group-by the partition key). I want to do something like this:
    SELECT PARTITION_NAME, COUNT(*) as PER_PART_COUNT
      FROM SOMETABLE
    GROUP BY PARTITION_NAME;Obviously, I would replace the string "*PARTITION_NAME*" with whatever function returns that value.
    NOTE: Before the forum sharks jump all over me, I did search the documentation and forums, but I came up empty handed.

    Hi,
    This is hokey - but you can use the undocumented function "tbl$or$idx$part$num" like so:
    SELECT   atp.partition_name
           , COUNT (*) AS count_rows
        FROM all_tab_partitions atp
           , (SELECT tbl$or$idx$part$num ("SCOTT"."TAB1"
                                        , 0
                                        , 1
                                        , 0
                                        , partition_col1 -- your 1st partition key column
                                        , partition_col2 -- your 2nd partition key column
                                         ) AS part_num
                   , 'TAB1' AS table_name
                   , 'SCOTT' AS owner
                FROM scott.tab1) pt
       WHERE atp.table_name = pt.table_name
         AND atp.table_owner = pt.owner
         AND atp.partition_position = pt.part_num
    GROUP BY atp.partition_name;Note - this probably won't perform well at all... but it could be an option...
    Message was edited by:
    PDaddy
    ... On 2nd thought - don't do it - it seems it is pretty unstable - brought my session to a halt a couple of times... Forget I mentioned it :)
    ... On 3rd thought - if you add ROWNUM - it works fine - seems you need to materialize the result set in the inner query - like so:
    CREATE TABLE part_tab (part_key int
                         , a int
    partition by range (part_key)
    (partition p1 values less than (100)
    ,partition p2 values less than (200)
    ,partition p3 values less than (maxvalue)
    insert into part_tab
    select rownum
         , rownum
    FROM all_objects
    where rownum <= 1000; SELECT atp.partition_name
         , COUNT(*) AS count_rows
    FROM all_tab_partitions atp
       , (SELECT TBL$OR$IDX$PART$NUM("PART_TAB", 0, 1, 0, part_key) AS part_num
               , 'PART_TAB' AS table_name
               , user AS owner
               , ROWNUM AS rn -- Materialize the result set by adding ROWNUM...
          FROM part_tab) pt
    WHERE atp.table_name = pt.table_name
      AND atp.table_owner = pt.owner
      AND atp.partition_position = pt.part_num
    GROUP BY atp.partition_name;

  • How to update a People and group field using a sandbox solution

    Hi,
    I am creating a sandbox solution for office 365 and creating a custom form using visual web part, which will allow users to enter data in a custom list.
    And that list also have a user field. I am able to get SharePoint user field on the form (using javascript) which is searching for the user and get a value (working fine).
    Issue: But I am not able to save the user value. Because to save user value I require web, UserID and login name, to construct SPFieldUserValue object or string in "111;#TestUser" format. Moreover that user should be present in
    SiteUserInfoList. 
    I tried web.EnsureUser() but did not work under sanbox solution.
    Can you please provide any pointer or workaround to the problem? I may be missing something here.
    Thanks,
    Himanshu

    Hi,
    According to your description, my understanding is that you want to update the people and group field in Sandbox solution.
    In the sandbox solution, you can still use the web.EnsureUser() function to get the user information, see the thread below:
    EnsureUser in sandboxed solution
    In additional, there is a demo with your similiar requirement for your reference:
    Using the People Picker Control in Sandbox Solutions / Office 365
    Thanks
    Best Regards,
    Jerry Guo
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Hi I do not want iTunes to open up automatically when I turn on my macbook pro.  I tried going to System Preferences Users and Groups Login Items and then I took iTunes off the list but it still opens up automatically when I turn on my laptop.

    Hi I do not want iTunes to open up automatically when I turn on my macbook pro.  I tried going to System Preferences>Users and Groups>Login Items and then I took iTunes off the list but it still opens up automatically when I turn on my laptop. What should I do?

    Hi r,
    Make sure you close iTunes before shutdown.  And you're quite welcome.

  • I am trying to stop programs from opening automatically when I turn my computer on.  I tried system preferences users and groups login items...then I deleted them from the list but it did nothing.

    I am trying to stop programs from opening automatically when I turn my computer on.  I tried system preferences>users and groups>login items...then I deleted them itunes and emial from the list but it did nothing.  They continue to open up every time I turn on my Macbook Pro.

    Hi r,
    It sounds like you're running Lion?
    Have you tried running Verify and/or Repair Disk?
    Have you tried running Repair Permissions?
    Do you have at least 15% free space available on your HD?

  • How to change default /Users and /Groups to different Volume?

    Users are created in /Volumes/<boot>/Users and groups in /Volumes/<boot>/Groups.
    We need these to be created on a different volume, eg., /Volumes/External/Users, and /Volumes/External/Groups.
    Setup Assistant correctly put user Backups into */Volumes/External/Shared Items/Backups* and also correctly put web services on /Volumes/External/ServiceData -- we want to do the same for Groups and Users.
    Groups are the most critical, as the group needs bulk storage. Users we could leave as is if it can't be done.
    How can this be configured? We've read File Server Admin, Open Directory Admin, and Advanced Server admin from http://www.apple.com/server/macosx/resources/documentation.html without finding an answer.
    Thanks in advance.

    1. Create new folders on the external volume to hold users and groups, but to prevent confusion name them something other than "Users" and "Groups". /Volumes/External/NetUsers and /Volumes/External/NetGroups would be reasonable choices.
    2. Share both of these folders (in Server Admin -> server name in sidebar -> File Sharing -> Volumes & Browse modes -> select each folder -> click Share near the top right).
    3. Enable both folders for automounting on clients (Server Admin -> server name in sidebar -> File Sharing -> Share Points-> select each folder -> Share Point tab under that -> Enable Automount option) with the default options (Directory: /LDAPv3/127.0.0.1, Protocol: AFP, Use for: User home folders and group folders). Be sure to click Save (not just OK in the dialog).
    4. To migrate users, run Workgroup Manager, and change the home location for the users you want to move (select Accounts in the toolbar -> /LDAPv3/127.0.0.1 from the hidden pop-up menu under that -> User icon tab at the left -> select the user(s) you want to change -> Home tab on the right -> select the NetUsers option from the "Where" list). Then, for each user, run this command on the server: "sudo cp -Rp /Users/username /Volumes/External/NetUsers".
    5. Similarly, move Group folders in WGM (Accounts -> /LDAP... -> Groups icon on left -> select groups to move -> Group Folder tab on right -> NetGroups in the list). Then, for each group, run "sudo cp -Rp /Groups/groupname /Volumes/External/NetGroups".
    6. Test to make sure all is working before deleting the old user and group folders from /Users and /Groups (do NOT delete /Users and /Groups themselves, just the individual folders from under them).

  • Generate report to show all users and groups in Shared Services in EPM 11x

    Hi,
    Is there any way to generate a report (like a migration report or job status report) which can be generated through workspace/shared services 11.1.1.3 so that my admin can look at all the users and groups created. Something that I can view and probably print out? Any suggestions?
    ~Adeeba

    Yes, I knew this one. This basically shows me the users and groups assigned specific provision access. Is there any way to view a report that shows which users and groups have access to dimensions of an individual planning application?
    ~Adeeba

  • Using member sorting and grouping with two reports sharing rows

    Hi!
    I have a problem with one report and I need some help or advise here.
    I have two dimensions with dynamic expansion in rows (PRODUCT, MATERIAL), and I use the option Member Sorting and Grouping at Member selector to obtain the total amount of PRODUCT group by PARENTH1:
    PRODUCT               MATERIAL          AMOUNT
    TOTAL PROD_A-X                                   100
    PROD_A_A             MAT1                          22
    PROD_A_B             MAT1                          50
    PROD_A_A             MAT2                          28 
    TOTAL PROD_B-X                                   120
    PROD_B_A             MAT1                          30
    PROD_B_A             MAT2                          50
    PROD_B_B             MAT2                          40
    This works fine if I only have one report, but I need to create another one sharing the row and page axis with the Default Report, when I do that the option Member Sorting and Grouping doesn't work. I really need to have two reports with shared rows and also the summation by PARENTH1, how can I do that?
    Thank you very much

    Hi!
    I have a problem with one report and I need some help or advise here.
    I have two dimensions with dynamic expansion in rows (PRODUCT, MATERIAL), and I use the option Member Sorting and Grouping at Member selector to obtain the total amount of PRODUCT group by PARENTH1:
    PRODUCT               MATERIAL          AMOUNT
    TOTAL PROD_A-X                                   100
    PROD_A_A             MAT1                          22
    PROD_A_B             MAT1                          50
    PROD_A_A             MAT2                          28 
    TOTAL PROD_B-X                                   120
    PROD_B_A             MAT1                          30
    PROD_B_A             MAT2                          50
    PROD_B_B             MAT2                          40
    This works fine if I only have one report, but I need to create another one sharing the row and page axis with the Default Report, when I do that the option Member Sorting and Grouping doesn't work. I really need to have two reports with shared rows and also the summation by PARENTH1, how can I do that?
    Thank you very much

  • Preview and image capture don't save imported scanned image

    Hi. Both preview and image capture aquire the scanner and displays the image overview. But when proceeding
    to scan, the application simply hangs and no image is saved.
    Maybe some prefs file is corrupted. Tried removing the com.apple.Preview from ~/Library/Containers, but didn't help....
    What to do???

    Not sure if this is relevant:
    1) TWAIN-BRIDGE is installed otherwise mavericks won't talk to the scanner.
    2) recently added an HP printer (no scanner). Shouldn't conflict with the scanner driver, but then again.....

  • Preview and Image Capture Not Recognising Scanner

    Preview and Image capture have stopped recognising my networked Canon MX350 scanner.  It seemed to occur after I used PhotoScore to scan some sheet music but that could be coincidence.  I deleted the scanner driver and reinstalled it from the Canon website together with the MP Navigator software, and I am now able to scan from MP Navigator but not Image Capture or Preview.  I have run Software Update but no updates are available.

    Apple's official documentation only provides an information about printing by using this device - scanner is not listed. I would suggest to look for specific drivers on Canon's official webpage.
    OS X: Printer and scanner software available for download - Apple Support

  • How do I Move video files from films to tv programmes and group the series together?

    I've recently ripped a tv series from DVD and successfully converted to play on iPad and iPhone. However it's listed all the videos under the "films" tab as individual files. How do I move them into the TV programme tab and group them together?
    Thanks for any help,
    Rick

    Select the files and Get Info. On the Options tab change the media kind to TV Show. On the Video tab set the Show name. Working with individual files set increasing Episode IDs of the form s01e01 and enter Episode Numbers. Leave Season Number blank if you want multiple seasons listed as a single object.
    tt2

Maybe you are looking for

  • Ipad2 to apple tv using Time capsule wifi

    I have an apple TV 2nd gen, a time capsule 1T 7.6.1 and an IPAD2 IOS 5.1. But I can not have the airplay button on Ipad2 usinf wi-fi by time capsule. I do not know if this is a port problem, or this config is impossible to work. Thanks, Vanderlei (fr

  • When is Apple going to introduce games and movies to SA iTunes???

    I am a dedicated Appple supporter and refuse to use any other product but i am extrmely frustrated with the limitations of content through the SA iTunes store!!! When will Apple start introducing games and Movie content to our stores?? I really hope

  • Portal Language Iview

    Hi, I need to add portal language iview in the personalized link, Where can i get this language iview. This is required to change the language of the users. Regards, Sanjeev Mourya

  • Why can I only create 4 forms when I have purchased the entire package at 100+ dollars?

    Why can I only create 4 forms when I have purchased the entire package at 100+ dollars?

  • Nls_calendar='Arabic Hijrah'

    Hi All, Is any one using nls_calendar='Arabic Hijrah'? Its working fine but the only problem that we are facing is, oracle shows arabic date which is exactly less than one day of arabic date. i.e. if arabic data is 14th, oracle shows 13th. Any one ha