Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Java/Regex

Options
  • 25-02-2010 1:09am
    #1
    Closed Accounts Posts: 43


    #3=#S(TABULATED-BNODE
                                 :NAME blah blah blah
                                                       :INDEX 3
                                                       :PARENTS (#2#)
                                                       :CHILDREN NIL
                                                       :ARITY 2
                                                       :VALUE-NAMES #4=(TRUE FALSE)
                                                       :CPT #(#(0.8999999761581421d0
                                                                0.10000000149011612d0)
                                                              #(0.20000000298023224d0
                                                                0.800000011920929d0))):
    

    Hi guys, trying to extract data using regular expression. Need to get two backreferences, one for the attribute (e.g. "NAME"), one for the data (e.g. "blah blah blah").

    Using this expression:
    :([A-Za-z0-9-_]+)\s+(.*?)\s*:
    

    It only extracts every second parameter, as if the overlapping : screws it up.

    Screenshot from regexr.com attached, any help appreciated. Thanks.


Comments

  • Closed Accounts Posts: 8,015 ✭✭✭CreepingDeath


    I avoid ".*" as it tends to expand further than I intended.
    Try creating a more specific pattern to replace ".*"


Advertisement