Getting the shortest match using regex

Hi,
I'm wondering how I can get the shortest match when I use the Matcher.find() method. For example, lets say my string is "AAAAB" and my pattern is "A+". after I call Matcher.find() i get "AAAA" when I call Matcher.group(). I want to get "A", then call it again and get "A", and so on.
What I'm trying to do is read a string and tokenize into pieces that match the regular expresion that I have.
Any help is appreciated. Thanks,
ranko

ok, to answer my own question it seems that using nongreedy matching works. adding a questionmark after a quantifier accomplishes this. so in my case I would use A+?.

Similar Messages

  • How to get the context data using java script in interactive forms

    Hi All,
    How to get the context data using java script in interactive forms by adobe,  am using web dynpro java
    thanks.

    Hi venkat,
    Please Refer this link.
      Populating one Drop-Down list from the selection of another Drop-down list
    Thanks,
    Raju.

  • How to get the list of Used Quotations & Non Used Quotations

    Hi MM Gurus,
    How to get the list of Used Quotations & Non Used Quotations.
    i am not talking about Open quotation ,closed quotation..
    if once i created PO through quotation it should be used quotation. i not created PO through quotation
    it s should be Non used quotation. how to get this list through when we create PO  through ME21N
    document over view. is there any opetion in Dynamic selection or somthing ..???
    Thanks in Advance..
    Anthyodaya.

    ok.

  • I need to get the cluster information using"MSCluster.Cluster" object

    Hi,
    Please anyone solve my problem ? I need to get the cluster information using"MSCluster.Cluster" object.
    Set objCluster = CreateObject("MSCluster.Cluster")
    objCluster .open <clustername>
    If i run the vbscript " Microsoft VBScript runtime error: ActiveX component can't create object: 'MSCluster.Cluster' " error is thrown.
    Kindly explain what is the issue and what can i do ? 
    -Sundar.

    this question was closed and answered a long time ago.
    Post questions about WS2012 in th WS2012 forum.
    The cluster object will no longer work in WS2012.  Use the supplied CmdLets and utilities.
    post future questions in the WS2012 forum.
    ¯\_(ツ)_/¯

  • I've been using my cell phone number to imessage from my ipad for a while now, but yesterday I got signed out of I message and when I signed back in, I didn't get the option to use my number, only my email adress. How can I fix that?

    I've been using my cell phone number to imessage from my ipad for a while now, but yesterday I got signed out of I message and when I signed back in, I didn't get the option to use my number, only my email adress. How can I fix that?

    Hey bill.rizzo2,
    Thanks for the question. I understand your phone number is missing on your iPad as an option for iMessage. The following article provides steps to resolve this issue:
    iOS and OS X: Link your phone number and Apple ID for use with FaceTime and iMessage
    http://support.apple.com/kb/HT5538
    Phone number missing on iPad or iPod touch
    If your phone number isn't listed on an iPod touch or iPad, follow these steps:
    1. Update to the latest version of iOS.
    2. Verify that you're using the same Apple ID that you're using on your iPhone.
    3. On your iPad or iPod touch, sign out of your Apple ID in the following locations:
        - Settings > Messages > Send & Receive. Tap your Apple ID, then tap Sign Out.
        - Settings > FaceTime. Tap your Apple ID, then tap Sign Out.
    4. Sign in to your Apple ID with FaceTime and iMessage.
    If your phone number still isn't listed, follow these steps:
    1. Sign out of your Apple ID on all iOS devices, including your iPhone, in the following locations:
        - Settings > Messages > Send & Receive. Tap your Apple ID, then tap Sign Out.
        - Settings > FaceTime. Tap your Apple ID, then tap Sign Out.
    2. Sign in to your Apple ID on your iPhone.
    3. When activation is complete, your Apple ID and all verified email addresses should be visible in Settings > Messages > Receive At and Settings > FaceTime.
    4. Sign in to your Apple ID on your other iOS devices.
    Thanks,
    Matt M.

  • Is there standard report to get the WBS by using asset number

    Dear All,
    Please advice, is there any standard report to get the WBS by using asset number ?
    Thank you.
    Nies

    We can get WBS report by using costcenter - S_ALR_87011966

  • How do i get the driver to use an HP laserjet 5mp with my Mac that runs Lion?

    how do i get the driver to use an HP laserjet 5mp with my Mac that runs Lion?  I'm told by HP to get it through Apple updates but it doesn't show up. 

    The term "server", while technically correct, is misleading.  A print server takes the low-level protocol spoken by a printer and serves it over a higher-level protocol.  For example, parallel printer port (a.k.a. Centronics or IEEE 1284) and serve it over USB.  Or parallel or USB and serve it over Ethernet with a variety of printing protocols (lpr/lpd protocol, JetDirect protocol, port 9100 protocol, the names are confusing).
    In reality, a print server looks nothing like what we usually associate with "server" (which is typically a biggish computer).  Instead they usually look like adapter plugs or even adapter cables, or like a little network hub (just with printer connectors instead of network connectors).
    Here are a few examples (I'll use Amazon as a guide book, without implying that I endorse them).  Let's start with USB to parallel; it seems they tend to look like adapter cables.  Here is one that takes a USB plug (male) and creates a female port that you can plug your regular old printer cable in: http://www.amazon.com/Cables-To-Go-16899-IEEE-1284/dp/B000UX21PY/ref=sr_1_1?ie=U TF8&qid=1333640548&sr=8-1
    And here is one that goes from a USB plug directly into the printer: http://www.amazon.com/Parallel-Printer-Adapter-Connect-parallel/dp/B000BV8604/re f=sr_1_4?ie=UTF8&qid=1333640548&sr=8-4 replacing the old printer cable.
    Then there are (really cheap) Ethernet to printer adapters.  Here is one that you put into the printer (warning, the plastic cover will probably not fit afterwards): http://www.amazon.com/TP-Link-AC-TL-PS110P-Single-Parall/dp/B003CFATR4/ref=sr_1_ 11?s=electronics&ie=UTF8&qid=1333640755&sr=1-11 By the way, I really don't like this type, I always find them unreliable.  But they are cheap.
    The ones I like look more like a network hub. Here is the NetGear PS110: http://www.amazon.com/NETGEAR-PS110-parallel-Ethernet-100Base-TX/dp/B0002AF9JU/r ef=sr_1_2?ie=UTF8&qid=1333640860&sr=8-2
    And the HP external JetDirect: http://h10010.www1.hp.com/wwpc/us/en/sm/WF05a/18972-18972-236253-34214-64302-273 16.html?dnr=1&jumpid=reg_r1002_usenc-001&lang=en&cc=us (I think this is the best one of the lot).  Both of those you put next to the printer, use your existing parallel printer cable, and connect them to the network.  Don't get scared by the astronomical price of the HP; it's commonly available used.
    There are even some wireless models around.  In theory, you might be able to use a parallel-to-USB adapter cable and then plug the USB cable into your trusty Apple Airport (as a good Apple fanboy or fangirl you've bought an Airport, right?), but I don't know whether that will work.  With the HP JetDirect box I'm quite certain that it will work (but it's old-fashioned, doesn't come in white, doesn't do wireless, and is not the slightest bit hip or cool).

  • How to get the best results using the refine edge tool?

    how to use the sliders in the refine edge tool? how do you get the best results using the fine edge tool?

    You should ask in the forum for the (un-named) program you are using
    The Cloud forum is not about using individual programs
    The Cloud forum is about the Cloud as a delivery & install process
    If you will start at the Forums Index https://forums.adobe.com/welcome
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says All communities) to open the drop down list and scroll

  • TS1292 When I go to purchase my song, I don't get the option to use my itune card balance, it only asks for my credit card number, even though I have a $15 balance on my itune card

    When I go to purchase my song I don't get the option to use the balance that i have on itune card, it only gives me the option to use my credit card

    Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact

  • How to get the computer name using C#?

    Hi all,
    Does anyone know how to get the computer name using c#?
    Thanks

    Try this, string computer_name = System.Environment.GetEnvironmentVariable("COMPUTERNAME");
    Naren.

  • HT204053 How does my spouse get the benefits of using my iCloud for contacts and calanders but not messages, etc?

    How does my spouse get the benefits of using my iCloud for contacts and calanders but not messages, etc?

    iCloud is designed for personal use and not for managing multiple access.  If you gives your password to someone else, this person can benefit everything including access to purchase with your account, email, etc.
    You should rather consider having each one an iCloud account and then, create and share a calendar.  As for contact, you can send them to your spouse to be save in her account but they cannot be shared nor synced.

  • I lost my phone 2 days ago, can I get the phoneNumber which use my phone by IMEI or Serifal NO  .  I am in China.

    I lost my phone 2 days ago, can I get the phoneNumber which use my phone now by IMEI or Serifal NO  .  I am in China.

    nothing unless you had "find my iPhone" installed before it was lost.

  • How do I get the Tomcat port using Servlet.

    I am running Apache + Tomcat. All request are going though Apache. How do I get the Tomcat port using Servlet.

    See:
    ServletRequest.getServerPort()This will give the port upon which the request was recieved . . .which I blelieve is what you are looking for.

  • Get the web name using web id in sharepoint

    Hi,
    I have a web id.I want to get the web name.
    can someone provide the code for it?

    you loop through the webs in you site collection and get the title of web once it matches with GUID.
    using (SPSite site = new SPSite("http://sp13devserver/"))
    SPWebCollection webcoll = site.AllWebs;
    foreach (SPWeb web in webcoll)
    if (web.ID.ToString() == "70c2c799-9154-4c46-b9a0-943fbbf67639")
    Console.Write(web.Title.ToString());
    Console.Read();
    My Blog- http://www.sharepoint-journey.com|
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful

  • How to get the closest match strings

    Hello All,
    I am looking for a select statement that will compare the alphanumeric value of my input string and return the closest matching alphanumeric value from my Cache table.
    The Cache table has 2 columns.
    CREATE TABLE Cache (
    ID int identity primary key,
    SearchWord char(10)
    INSERT INTO Cache
    VALUES ('20');
    INSERT INTO Cache
    VALUES ('20A')
    INSERT INTO Cache
    VALUES ('20B')
    INSERT INTO Cache
    VALUES ('20A-1')
    INSERT INTO Cache
    VALUES ('20AB-223')
    INSERT INTO Cache
    VALUES ('20" Mainline')
    INSERT INTO Cache
    VALUES ('WEP3-SEG-1')
    INSERT INTO Cache
    VALUES ('WEP3-SEG-1A')
    INSERT INTO Cache
    VALUES ('WEP3-SEG-1B')
    INSERT INTO Cache
    VALUES ('WEP3')
    I am trying to use Difference function, but it is not working properly.
    select c.*,Difference(SearchWord, '20') from Cache c
    where SearchWord like '%20%' ORDER BY Difference(SearchWord, '20') DESC
    When I search for 20 in this table, I have to get all the closest matches i.e., 20, 20A,20B BUT NOT 20a-1,  20AB-223 and 20" MAINLINE and when I am searching for WEP3-SEG-1, I have to get WEP3-SEG-1, WEP3-SEG-1A but not WEP3 in the resultset.
    How can I achieve this?.
    Thanks for your assistance.

    Develop your own user-defined scalar difference function. You can name it udfDifference.
    BOL: Create User-defined Functions (Database Engine)
    UDF blog:
    http://www.sqlusa.com/bestpractices/training/scripts/userdefinedfunction/
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Database Design
    New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014

Maybe you are looking for

  • Start up and basic function problems

    My computer has been running abnormally slowly recently. For example, it will take about 30 seconds to start apps such as ichat, mail, or safari. Occasionally, my computer will just freeze and i won't be able to switch spaces, applications, windows o

  • ITunes won't let me authorize my new computer because I already have 5 computers authorized. One of those computers are broken so I can't deauthorize it!

    Ok so i have a new computer and i want all of my songs on it. problem is, i have 2,000 songs on my old computer and i really dont wanna waste a bunch of time downloading them back so i was gonna use homesharing on itunes. another problem is i already

  • Returns order type settings

    Hi, Can anybody please guide- How the setings for returns (for free goods) be changed so that return delivery will not need to show up in vf04 for billing. Points will surely be rewarded. Regards

  • Not all pictures transfered from pe10 to 11

    I have discovered not all pictures have transfered over from pe10 to 11. I have since added pictures to 11. Now what? Keyward tags for example hve question marks and no pictures associated with the keyword but everything is fine in pe 10. What happen

  • Can't create a sign in seal

    Afternoon all XP SP3 I downloaded some microsoft updates this morning, including IE8. After updating I ran ccleaner to tidy up the registry. My sign in seal on BTY has disappeared and I don't seem to be able to create a new one. Any suggestions? TIA