How do you get java regex to match two different pattern

Hi,
I am having trouble getting getting java regex to match two pattern: "unknown host" or "100%".
Here is a snippet of my code:
try{
Process child = Runtime.getRuntime().exec(" perl c:\\ping.pl");
BufferedReader in = new BufferedReader( new InputStreamReader( child.getInputStream() ));
String patternStr = "(unknown host | 100 %)";
Pattern pattern = Pattern.compile(patternStr);
Matcher matcher = pattern.matcher(" ");
String line = null;
while ( (line = in.readLine()) != null){
System.out.println(line);
matcher.reset(line);
if (matcher.find())
// line matches throws pattern
System.out.println("match string");
else
System.out.println("no matches");
I thought the "|" means OR but somehow it is not working.
kirk123

Hi,
with String patternStr = "(unknown host | 100 %)"; you are looking
for the strings "unknown host " OR " 100 %", with the spaces after host and before 100.
Try "(unknown host|100 %)"
hope, this will help you

Similar Messages

  • How do you get FaceTime to work between two Mac's with the same email address? Thanks, Mike

    How do you get FaceTime to work between two Mac's with the same email address?

    I would like to know the same thing.  How does facetime work between a MacBook Pro and an I Pad that run off the same email address/mac id

  • How can I get the program to recognize two different types of thermocouples?

    I am using a PCI-4351 card with a TBX-68T terminal block. I was having trouble writing and finding a program that would give me more than one reading/sec. I found a program on the NI website called "435x_logger_triggering", and so far it is the only program that I have found that will actually collect data at 60 Hz. Unfortunately, this program only lets you specify one mode for your thermocouples. This is a problem because we are using two thermocouples, one is type K and the other is a type R, so we get bad readings from one of the thermocouples depending on which mode it is set on. I would like to know how I can program in a seperate mode for each channel in this program. Un
    fortunately, some of the sub VI's in this program are password protected, so I don't know if this is possible. Everything is entered correctly in the Measurement and Automation explorer, so that isn't the problem. I will attach a copy of the program that I am using. I have modified it slightly from the one I got off the NI website, so that the thermocouple readings have a time stamp and are saved to disk. Any assistance you could give me would be greatly appreciated.
    Thanks,
    Jordan
    Attachments:
    Forest_Fire_Thermocouple.vi ‏140 KB
    435xlogger_triggering.vi ‏110 KB

    Jordan,
    You should be able to sample two different thermocouples in the example that ships with the 435x driver called "Getting Started with multiple tranducers Continous". Simply put each type of thermocouple in a different index . Each index of the Transducer Group Array can have a different type and specify the channels that correspond to that type.
    One way that you can speed this VI up is to place a wait inside of the while loop. This will reduce the number of times the software polls the card if it has available data(increasing the overhead). I would suggest about 500 ms. The data that you receive will all have the same delta t because the sampling clock is hardware driven not software, so it does matter when the data is polled.
    You will not be
    able to get 60 samples per second when you are measuring multiple channels anyway. The sample rate for multiple channels is about 9/(# channels). This is explained in the 435x Users Manual.
    I looked at your code and noticed that you tried to change some of the enumeration controls. Unfortunately you will not be able to change these because they are password protected on the low level subVIs, which is where they are defined.
    The way you select if you want the notch filter is in the 435x Config you specify fast or slow. If it is slow then it will select 10Hz as the nitch filter. If you select fast the it will select either 50 or 60Hz You would then use the function "435x Set power line frequency"
    Good luck,
    Mike

  • How do you get an exact color match?

    I can paint the bumper of this car but I get a flat color instead of the shine that normally comes with a car, how do you do this?

    I would use the Paintbucket Tool.
    Here is a step through:
    Auto on Background Layer.
    Create Selection (about what you have shown for that area, but I'd make it just a bit larger), and Save Selection.
    Take Color Sample from a similar area.
    Save to Swatches Panel, in case you need it again.
    Create New Layer, above Background Layer.
    Load Selection.
    Use Paint Bucket.
    Save Selection as Layer 1 Layer Mask for later.
    Change Blending Mode in Layer 1 to Color.
    Make the Layer 1 Layer Mask Channel active in Channels Palette.
    The colors will now switch to black and white, so you can paint in, or out that Layer Mask, and can use the Blur Tool, or a Filter, like Gaussian Blur to soften the edges.
    If necessary, you can add a Levels Adjustment Layer to Layer 1, and alter things a bit.
    Hope that helps, and that I have not forgotten a step. In the US, on Memorial Day, I have declared Wine-thirty early...
    Good luck,
    Hunt

  • How can I get one link to open two different PDFs?

    Even though I'm only the hardware support guy where I work, I've been asked to maintain the web site. The latest request is that they want to get one link to open two PDFs. I know you can do something like that with web pages, but I'm not sure if you can do the same with PDFs. I only know the basics of Dreamweaver, so, if it can be done, please explain it to me like I'm a 5-year-old. However, I'm not afraid of code. Thanks, in advance, for any assistance.

    Hi
    You can do this by using the javascript onClick event to load the 2 pdf's, but if I was to see such action when clicking a link I would suspect that it was trying to open multiple pages, (as per spam sites) and immediately close the tabs/windows and never visit the site again.
    If you do require two pdf's then merge both pdf files into one, and link to the single file as normal.
    PZ

  • How do you get iWeb to look at a different folder?

    I have two versions of my site (one slightly more updated than the other) on my hd, and want to point iweb to the newer one. I know how to point iweb to where it will be pulishing TO, as in godaddy, or my dropbox or whatever. But how do I change the folder it is publishing FROM, the folder that holds the site materials.
    thanks!

    NOTE: In Lion and Mountain Lion the Home/Library folder is now invisible. To make it permanently visible in Lion or Mt. Lion enter the following in the Terminal application window: chflags nohidden ~/Library and press the Return key - 10.7: Un-hide the User Library folder.
    For Mavericks, 10.9,  go to your Home folder and use the View ➙ Show View Options menu to bring the this window:
    where you can check the Show Library Folder checkbox.
    To open your domain file in Lion, Mountain Lion or Mavericks or to switch between multiple domain files Cyclosaurus has provided us with the following script that you can make into an Applescript application with Script Editor. Open Script Editor, copy and paste the script below into Script Editor's window and save as an application.
    do shell script "/usr/bin/defaults write com.apple.iWeb iWebDefaultsDocumentPath -boolean no"delay 1
    tell application "iWeb" to activate
    You can download an already compiled version with this link: iWeb Switch Domain.
    Just launch the application, find and select the domain file in your Home/Library/Application Support/iWeb folder that you want to open and it will open with iWeb. It modifies the iWeb preference file each time it's launched so one can switch between domain files.
    WARNING: iWeb Switch Domain will overwrite an existing Domain.sites2 file if you select to create a new domain in the same folder.  So rename your domain files once they've been created to something other than the default name.
    OT

  • How do you get Workforce 840 to print two-sided

    I can't figure out how to get my new Epson Workforce 840 to print two-sided (iMac running Mac OS 10.7.2).  From MS Word the two-sided option (in Layout) is grayed out.  In Mail and other Apple applications the Preset for two-sided printing is off and I can't figure out how to turn it on.  The two-sided print function works as expected when I print from Windows 7 software (Bootcamp) or if I use the LCD controls on the printer to have copies printed two-sided.  Probably something obvious, but I'm a newbie to the Mac world, would appreciate some help.  Thanks.

    I am not sure if it is still valid for OS X 10.7, but check the User Guide.  Go to Output Settings
    Then make your choces:
    All instructions and images are from the online Users Guide on the Epson US website.
    Message was edited by: Matt Broughton

  • HT1420 How can you get your iTunes music back when your iTunes Match expires & you no longer have access to the computer it ws stored on?

    How can you get your iTunes music back when your iTunes Match expires & you no longer have access to the computer it ws stored on?

    Try here:
    iTunes: Error 13019 during sync

  • How do I get my printer to match the colours of the image as I see it on screen?

    How do I get my printer to match the colours of the image as I see it on screen? My HP Office Jet Pro L7680 printer tends to print my images with a bias towards red compared to the image I am seeing on screen with Lightroom 5 using a Mac with Retina 5 screen. Would appreciate any expertise on how to calibrate the printer to the screen

    You have two options. The first method costs nothing but is not as accurate and the second means buying hardware and investing some time. The fastest way to get things closer is to download the color profile from the printer manufactures site for the printer and paper combination you are using. Install it on you Mac and relaunch LR. This is best when the paper and printer are both from the same company; in your case, HP. If the paper is not made by HP, you can often find profiles for your paper/printer by going to the paper maker's web site and doing a search for the appropriate profile.
    The other alternative is to purchase a piece of hardware such as the ColorMonki which can be used to not only profile your monitor for color balance but also you printer/paper as well as your camera. When all of your devices agree on what color 118,118,118 means, you get the same color from capture to print but this is also an expensive option and there is a lot of time involved in building your own color profiles. The results however, are much more accurate.
    Once you have a color profile installed, the next step involves doing soft proofing. Once you have your image looking the way you want it to in LR, open it in the soft proof option. This will show you how your print will look using the color profile for the paper/printer you are using. During the process, you will be shown the print on your screen which may look off. Use the small triangle in the upper-right corner of the histogram to turn on the out-of-gamut warning. This will highlight any parts of your image which contain colors your printer can't handle. Use the rendering intent options to decide how you want these colors handled (relative or perceptual). Check them both and use the one you like best. You can also make additional changes at this point if required before you generate the JPG image. Make sure to save it as a max quality JPG using the sRGP profile. Once saved, you can send this image to your printer or even to a lab as the process is the same.The attached link should get you to a video showing how to use the ColorMunki hardware/software but, more importantly, shows you how to prepare an image for printing (in this case, for a lab) using soft proofing with the color profile created (or downloaded).--Great Color from Your Lab Prints – Every Time! on Vimeo

  • Than how can i get java class by using it's class file?

    Hi
    After compilation of a java program, it creates a class file.
    After getting class file suppose class file has been deleted.
    Than how can i get java class by using it's class file?
    Thanks in advance.

    get a decompiler and run your class file through it--I'll assume you want the source code back and that you are not trying to recover a missing class file by attempting to use the class file that is missing--if it's missing, then I've not a clue on how to get it back by using what is already missing.
    BTW: many of your compilers have source control--if it does, just restore your missing file.

  • You have created a link to another part of your book but how do you get the reader back to the original page?

    Using iBooks Author to make a book you have created a link to another part of your book but how do you get the reader back to the original page?

    Asking me to be verbore is a dangerous thing  :-)
    When you eneter information into iTunes Producer for uploading, the info must match what is in the internal metadata. In this case, the book is called Mississippi, but in  iTunes Producer it is spelled Misssissippi. There is an extra "s". This will cause an error.
    - Fabe

  • HT5055 How do I get Java for OS X Lion 2012-003

    How do I get Java for OS X Lion 2012-003?

    You can download and install from the following website:
        http://www.macupdate.com/app/mac/39490/apple-java-for-os-x-lion
    Hope this helps

  • How can I get Java plugin to work

    How can I get Java plugin to work ?

    Greetings Dun1203,
    Welcome to the Apple Support Communities!
    I understand that you would like to install or update Java on your Mac. For information on this process, please use the information provided in the attached link. 
    Java updates available for OS X on August 28, 2013 - Apple Support
    Cheers,
    Joe

  • How did YOU learn Java?

    Ok, two part question and a bunch of help for this Java newbie:
    1. How did you learn Java? Online tutorials, books, discussions, a game, or a class? Be specific and think back to when you looked at a Java program and went "wtf?"
    2. How do you keep up the new versions and therefore, useless older classes? I am reading the list on JDK 1.4 and just thinking, how could I remember all of this? If I'm used to programming one way, how can I relearn for every version?
    If I could just get some honest answers and opinions, it'd be greatly appreciated, Thanks!

    Get this:
    I originally 'learned' Java from "Java Made Simple" by Peter McBride. "Made Simple" is right: having finished this book, I had no idea that you could design your own classes for use by other classes! All my methods were static, I'd never written a constructor or instantiated one of my own classes, and my applications were all contained in a single class! I had only the vaguest notion of what "object oriented" meant, and I wondered why, for example, you had to say
    Integer x = new Integer(4);
    but not
    int x = new int(4);
    The book was intended, I think, for non-programmers who have been given some free space by their ISP to design a web page, and want to add some v. simple applets for decoration. Beware of books like this if you want to learn Java in a serious way.
    For a more positive tip, I recommend Sun's very own online Java Tutorial. It covers all the key topics thoroughly and clearly, so at the end you have a good understanding of Java (More than just the basics, I'd say). If you want to move on to more advanced topics this tutorial will probably stand you in good stead (I can't be certain as I haven't moved on from here yet myself), but if you don't you will still be able to write good amateur programs.

  • How do I get the content to match when exporting pages document to word?

    How do I get the content to match when I export a pages document to word format?

    You simply cannot get an absolutely identical export, in any app to any app. Exporting from one app to another means converting/parsing code, therefore the result cannot be identical. In order to have control over your final result, use PDF export. If you need a closer compatibility with Word, use OpenOffice or LibreOffice. I would not bet that Word for Mac would presserve identical page setting if file is created in windows, or vice-versa.

Maybe you are looking for

  • Connecting to Sony 46'' ex700

    I have a Macbook from late 2007 and I wanted to hook it up to my Sony Led Tv. I have the correct cables and it works fine on the Samsung TV, but the Sony tv doesn't seem to recognize the macbook. Any solutions? Thanks

  • Tethering a Storm to a MacBook Pro

    Has any one successfully done this so you can use the Storm as a Modem for the Mac? Can you do it with Blue Tooth  How about the Sync cable? Thanks Dunc

  • URGENT inventory reports

    Hi friends, I would like to see a report by Product line/Profit center, I checked these reports, MCBE,MMBE,MCBC,ME80AN. Where I don’t see any field that can show Profit center, And also I would like to see a inventory report  by material, qty, batch,

  • SharePoint 2013 PerformancePoint services & SQL editions?

    Hello All, We have SharePoint 2013 enterprise edition and we wanna configure PerformancePoint services to use some of its functionalities, What edition of SQL server should we have? Is it OK to use standard edition? Anyone has any reliable technical

  • Partner and Competitor objects in R16

    We have utilized both the Partner and Competitor related objects with our implementation of SOD. Finally, with R16 we will now be able to report against these relationships. This has been a longtime getting to the table, but is finally here! We can a