Expressions and model matchers

I want to parse a string using reg expressions, but I want to clarify a string from end of string - all characters - start. I want him to stop the first time he finds the end string not the last time that he finds it.

Here is my code
Public Shared Sub main (String [] args) {}
String text = "" an it's first group b an it's second group b b xxxxxxx ";"
String oldHeader2 = "a.*b"; I want the search to stop after the first b
Pattern pattern = Pattern.compile (oldHeader2);
Matcher Matcher = pattern.matcher (text);
While (matcher.find ()) {}
System.out.println("---");
Get the corresponding string
Matching strings = matcher.group ();
System.out.println (match);
}

My output is as follows
----
a this is the first group b an it's second group b b xxxxxxx

I need to go out like that
----
a this is the first group b
----
a this is the second group b

cjgoode wrote:
I want to parse a string using reg expressions, but I want to clarify a string from end of string - all characters - start. I want him to stop the first time he finds the end string not the last time that he finds it.

public static void main(String[] args) {
String text = " a this is the first group b a this is the second group b xxxxxxx b";
String oldHeader2 = "a.*b";  // I want the search to stop after the first b
Pattern pattern = Pattern.compile(oldHeader2 );
Matcher matcher = pattern.matcher(text);
while (matcher.find()) {
System.out.println("----");
// Get the matching string
String match = matcher.group();
System.out.println(match);
}
}

You use a greedy quantifier, but you want a reluctant quantifier.
http://download.Oracle.com/javase/6/docs/API/Java/util/regex/pattern.html#sum

Tags: Java

Similar Questions

  • "Matches regular Expression" and "Model match" vi behaves differently

    Hello

    I need a simple matching chain and experimenting that found the "Regular Expression Match' and 'Correspondence model' vi behave a little differently. I guess that the entries of the regular expression on the two the same behavior. It's a difference that I discovered that the "|" character ("vertical" character, commonly used as an operator 'or') is recognized as such in the regex to Match vi, but not in the match vi model (where it is taken to the letter). Furthermore, I can't find any document using (online or in LabVIEW) on the ' | ' usage in regular expressions of character. Is - this documented anywhere?

    For example, suppose I want corresponding to one of the following 4 words: 'The' or 'fast' or 'brown' or 'fox '. The regular expression ' the | fast | Brown | Fox' (without the quotes) works for the vi Regular Expression Match but not the match pattern vi. Here is a photo of the block diagram and the results of the façade:

     

    The Help explains that the vi Regular Expression Match performs a little more slowly the match vi pattern, so I started with the latter. But since he does not work for me, I'll use the old. But does anyone have an idea of the speed difference? I guess that's negligible in a simple example.

    Thank you!

    Thank you, Jeff. That's what I was looking for. BUT my version of LabVIEW 8.5, does NOT say "functionfor example, the Match model does not support the parenthesis or vertical bars (|) characters.«» !

    See: http://zone.ni.com/reference/en-XX/help/371361D-01/glang/match_pattern/

    and http://zone.ni.com/reference/en-XX/help/371361D-01/glang/match_regular_expression/

    It is not mentioned in the help of special characters used for the match pattern : http://zone.ni.com/reference/en-XX/help/371361D-01/lvhowto/specialcharformatchpatt/

    The only place | has 'talked', it is in the sentence: "some regular expressions that use alternating (such as (. |))". \s)*) require significant resources to deal with when it is applied to the large input strings. "But I'm not processing a large chain.

    It seems that NEITHER fixed this omission. What version is your help?

    Ed

  • Throughout the year the iMac Intel and models boot from an external USB disk?

    ?

    Trying to help a post here it is in a jam and I'm trying him on a path of least resistance to cure its ills.

    Do every year Intel iMac and models able to boot a USB external hard drive?

    Here is the message for those who are curious.

    It is in a real bind.

    HELP... lost my businesses together work of the reader

    Thanks for any idea.

    Yes. Click here for more information.

    (142246)

  • Help with Airport Express and Configuration capabilities

    I have a new Airport Express which is set to expand the network wireless (created by Time capsule).  Is it possible to also provide a wired connection to another device in this mode?  If so, how do I need to change the settings? The other device is a hub of lighting (not wireless) which must have an Internet connection to allow remote control of lights.  It is currently connected to the CT but its location does not cover a part of the House, the new AE is the perfect place.

    Is it possible to also provide a wired connection to another device in this mode?

    Yes

    If so, how do I need to change the settings?

    Some settings need to be changed. By default, both the "O" WAN port and port LAN <>- both act as LAN ports. Choose one or both to an active Ethernet connection.

    The other device is a hub of lighting (not wireless) which must have an Internet connection to allow remote control of lights.

    Turning off the hub of lighting, make the Ethernet connection to the AirPort Express and the hub of power upward. You should be in business.

  • no more WiFi which extends from the airport express and Time capsule

    I have no more WiFi which extends from the express airport and Time capsule.

    and once it worked...

    airportconfiguration-app also works, but the graphic display allows to have a straight white line. now, it's one interrupted...

    Your unbroken lines in airport show connections ethernet utility... broken lines show the wireless connections.

    So it depends on the extend method you used.

    I think at this moment, things are configured wrongly... for some strange reason things happens and elements on a stand-alone basis, return to a default mode.

    The best way to manage it is full factory reset on everything... and repeat the installation.

    I have no more WiFi which extends from the express airport and Time capsule.

    It seems to me that you extend a NON-APPLE router... in this case, your Apple routers must connect by ethernet and create a wireless network. Routers Apple cannot extend the NON-APPLE router wired.

    The express could extend the TC or visa versa... by wireless...

    Then I suggest say us what is the main router in the network?

    You have connected by ethernet to the TC or Express or both?

    If so please reset completely the two elements and try again. Make sure they are in bridge mode... It's the network tab. Router Mode is turned off.

    And your wireless tab is configured to create a wireless network...

    Use the same name (SSID) and even the security setting and the password as the main router to network roaming (extend wireless ethernet).

    If the Express and transport CANADA are the same, both will have this configuration... If the express extends to wireless then it should NOT be connected to all the way to ethernet... (sequel to wan side at least) and it will be set to expand wireless on the wireless tab.

  • Extend my cable modem network via Airport express and Time Capsule

    I am trying to expand my home network through my Airport express AND a Time Capsule. Installation of extension through the airport was easy and successful. I then tried to expand further with Time Capsule, but it gives me the opportunity to launch a new network. What do different to fix my Tim Capsule to my global network?

    I then tried to expand further with Time Capsule

    Unfortunately, it is not possible to do what you want... given that the function of "extend a wireless network" Apple will not accept to be extended once the network is not two.

    The other question that you probably, it is that unless your 'main' router is also another router from Apple, the Express is not really 'extension' of the network at all, despite what you think.  More likely, the Express is "membership" in the network. It can be used to connect a USB printer remote in this environment or for use with AirPlay... but the Express doesn't "spread" or "repeat" when he joined the network.

    If you want to check if the Express is really extend the network, and you have a Mac laptop... after back and provide you with a few steps.

    But even if the Express could be the extension of the network... Time Capsule will have to connect to the network using a permanent, wired cables Ethernet... ideally to your main router, but it might work OK if you connect to the Express.

  • Time capsule airport unplug my Airport Express and internet

    Howdy,

    I just brought my Airport Time Capsule of the work. I have the joint via an Ethernet cable to my extreme, both are in my basement. Upstairs, I have a set Express in place to expand the wireless. The extreme and Express worked for many years now.

    Once the time Capsule has been recognized in the public services of the airport, he made an update of the firmware.

    After that, I edited the settings for the time Capsule to my home network and set it to "develop wireless."

    Extreme, Express and Time Capsule all had them green to light up in public services - so I tried to run a Time Machine backup, and things went sour.

    The cable modem the extreme is connected to started to abandon the connection every 30-45 seconds and the Express light went red and there is no longer recognized, so I clicked "forget" to remove it. Time Machine could not locate the time Capsule.

    So I unplugged the Time Capsule, all rebooted and now my extreme and Express up and running again.

    What waste?

    Thank you

    Dan

    After that, I edited the settings for the time Capsule to my home network and set it to "develop wireless."

    I think you probably mean "extend a wireless network".

    This is the bad setting... because it would be used only if the time Capsule connected to your network using Wireless.  You specify the Time Capsule connects using Ethernet.

    Here is what is happening now... the time Capsule waiting for a wireless connection, but he gets an Ethernet connection.  This translates into a huge feedback loop that effectively blocks your network.

    The correct setting for the time Capsule would be "create a wireless network"using the same exact wireless network name, security and password as other Apple routers. " Finally, make sure that the time Capsule is set to run in Bridge Mode before you click Update to save the new settings.

  • difference between microsoft lifecam studio model # Q2F-00013 and model #Q2F-00001

    What is the difference between microsoft life cam model studio # Q2F-00013 and model # Q2F-00001

    Hello, Paul.

    See details on the two

    Q2F-00001

    http://www.Microsoft.com/hardware/en-us/p/LifeCam-Studio/Q2F-00001#details

    Q2F-00013

    http://www.Amazon.com/Microsoft-LifeCam-Studio-webcam-Q2F-00013/DP/tech-data/B0096KSBB0/ref=de_a_smtd/176-9485188-1536144

  • Envy of HP dv7-7255dx C6N73UA: search for information on the motherboard brand and model for HP laptop

    I am looking for the exact make and model of motherboard of my laptop.  Is there someone who has some info on it?  My laptop is the HP dv7-7255dx C6N73UA Envy.

    Thanks in advance.

    I'm sorry. I missed that.

    The easiest way to do this is by using the HP Partsurfer. Entry of your laptop and parts available information will be displayed.

    http://PartSurfer.HP.com/search.aspx?IsmobileDevice=Y

  • After removing Office 2010 Trial, I lost my address book Outlook Express and cannot open emails.

    I installed a free trial of office 2010, but he did not understand the editor which was what I wanted.   I uninstalled it now I lost my address book in outlook express and can't open saved emails.

    I can't find my software or backup and think that I lost when I moved.

    Lynn

    Yes, you will need to reinstall Office 2000. When you installed Office 2010 trial, he removed Office 2000. Once you get the cd, reinstall Office and should be back up and running.

    I can't offer any assistance with address number address Outlook Express however.

    Thank you...

  • It's urgent! How can I delete my account in outlook express and the history of mail?

    Dear Ms team / users.

    Today I just connected my gmail account in outlook express and it's connected and started to download all mails on my computer.
    As it was not my personal computer, but the office so I want to remove my account from outlook express and delete the history that there are.
    I think I deleted my account, but I'm not able to remove the history accordingly, anyone can see my emails just by clicking on outlook express.
    Please help it is urgent.
    Thanks in advance.
    Kind regards
    Vaibhav

    Follow these steps only if no one else is using this Outlook Express identity.

    1: in OE: tools | Accounts | Delete the account.

    2: delete all messages in the OE files and empty the deleted items folder.

    3: remove all the dbx files in the message of store with OE closed. When it is open, new, and create empty dbx files.

    Tools | Options | Maintenance | Store folder will reveal the location of your Outlook Express files. Note the location and navigate on it in Explorer Windows or, copy and paste in start | Run.

    In Windows XP, the files of user OE (DBX and WAB) are by default marked as hidden. To view these files in Windows Explorer, you must enable Show hidden files and folders under start | Control Panel | Folder Options icon | Opinion, or in Windows Explorer. Tools | Folder options | View.

    Close OE store folder and open Outlook Express. Select all the dbx files and delete them.

  • When Windows XP is finished in April 2014, will I still be able to use Word? I'll always be able to use Outlook Express and Internet Explorer? Or they all will be unavailable?

    I have Windows XP Service pack 3.

    Hi Christine,

    Support for Windows XP will be completed; However, you will be able to use Microsoft Word, Outlook Express and Internet Explorer without any problem.

    For reference:

    Record the lifecycle of Windows:

    http://Windows.Microsoft.com/en-in/Windows/products/lifecycle

     

    I hope that the information above helps you.

  • With the help of old Windows CD to install the optional component deleted Outlook Express and I need to get it back!

    We have received a Windows XP laptop from a friend and use Outlook Express for e-mail. We had a number of other things such as pilots with the laptop but not the Windows CD.  Then we wanted to reduce the size of a jpg image and I wanted to use MS Photo Editor to do what I then read on the Microsoft site that I could get by installing from any Windows CD.  Therefore, I used an old Windows XP CD from another PC, choose to install an optional component and chose as accessories to the next screen, ensure that all other options were struck down, assuming that so they would simply not be installed.  One of them was Outlook Express and Internet Explorer.  Instead of THIS the wizard DELETED Outlook Express and Internet Explorer.  When I tried to get him back by checking these options, asked me for the 2nd day of the original installation CD - which of course, I did not!  I have managed to re - download IE8 from Microsoft Download site, but of course do that for Outlook Express - and we don't have Office on this computer: (.)  Help!  (a) is it possible to reverse this process to remove/uninstall Outlook Express? (b) we now lost all our emails? (c) I already tried to go back to a previous good configuration, but that has not worked.

    Thank you in advance for advice, answers or help.

    First, make sure that OE has actually disappeared.  Go to start | Run and paste this and see if OE starts:

    "c:\program files\Outlook Express\msimn.exe".

    Including the quotes and see if OE starts.  Very often "withdrawal" OE removes just the shortcut to it.

    If this does not work, you can try reinstalling XP SP3 (http://windows.microsoft.com/en-US/windows/help/learn-how-to-install-windows-xp-service-pack-3-sp3), but you should probably uninstall IE8 first and then reinstall it later.

    You can also go to the c:\windows\inf directory and locate the msoe5.inf file and right-click on it and choose Install and see if that fixes things.

    See if that works.

    Steve

  • Cooperation Outllook Express and Outlook 2010

    I have a desktop with Outlook Express and a laptop with Outlook 2010 using the same email address (for a small business).  When I open Outlook Express, everything disappears from the Inbox in Outlook, even if I watched it.  I really need as a whole.  How do I do that?  My PC has XP and Office 2003 whereas my laptop has Windows 7 with Office 2010.

    You must use the IMAP protocol on both computers - it seems that OE is configured for POP3 and Outlook for IMAP.

  • Error: 0X0800C0133 with Outlook Express and cannot receive e-mail

    An unknown error has occurred with my Outlook Express and I can't receive emails. It is erroe 0X0800C0133. Please I need help on how to remove it and fix my Email

    It would be useful also (in terms of it being assistance), if you can insert your message standard on this subject as it goes in detail on the issue, than my comment and the topic of the thread inside error number, many perhaps find via search.

    Thank you

    Steve

Maybe you are looking for

  • How to remove a custom toolbar.

    Where are stored the definitions of the custom toolbar? I created one, but now want to permanently delete it. Everytime I open Firefox is activated and I have to disable in the view menu. My preferences are not stored. This has happened in the last u

  • HP touchsmart 300... OS questions

    So I bought one of these touch HP everything in those of my pawnshop local anyway not long after the HARD drive died on me, so I replaced from the original HARD disk a put windows 7 64 bit on it but when I did I lost much original drivers and the med

  • Satellite P300D - 21K - problem Hibernate / sleep

    Toshiba Satellite P300D - 21K was pre installed with Vista Home edition, but no more. It has Win 7 64 bit blank installed RAM was fun to the maximum and there is no additional software that was installed on the PC yet just the OS package is. I put th

  • my laptop HP 1000 1127tu, intel core i3

    Hi CV! Can I put my HP 1000-1127TU laptop intel core i3 to 1 GB or 2 GB videocard?

  • I need to know how to spray canned air, I don't want to hurt

    I would like to know how long away from my laptop I spray air canned because I have no money for geeks to come and do I look like, but would like to know to what extent