Split a word with hyphen

I am splitting a line of text into individual words:
String[] tokens;
tokens = inputLine.split("\\s+");However, I also need to split words that have a hyphen in them (e.g. hamster-eating monster). How can I do this? Can I split the tokens twice? I need both set of splits to be saved into the tokens array so all the split words are in the same String array.
Message was edited by:
Lava_Java

The brackets make a character class. They mean "any character listed in here." It's not a subtraction. It's a literal hyphen.
So "[\\s-]" means "any character that's in the whitespace character class or the hyphen"
Sun's Regular Expression Tutorial for Java
Regular-Expressions.info
http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html

Similar Messages

  • Can we get the list of words with hyphenation breaking used in English:US dictionary?

    Hi,
    I require list of words with hyphenation breaking used in English:US dictionary. I have reviewed in InDesign supporting files in my local folder but I couldn't get. Can anybody assist?
    regards
    Masthan

    InDesign uses Proximity dictionaries for most languages to verify spelling and to hyphenate words. You can add words to each dictionary to customize it. You can assign different languages to text, and InDesign uses the appropriate dictionary to handle spelling and hyphenation.
    There are possible breakpoints the dictionary will consider and then show up in the InDesign , if you want to know between which two syllables Indesign’s dictionary prefers to hyphenate, and what other possible breakpoints the dictionary will consider.
    Choose Edit > Spelling > User Dictionary.
    In the Language menu, choose a language. Each language contains at least one dictionary. If you want the word to be added to all languages, choose All Languages.
    In the Target menu, choose the dictionary where you want to store the word. The Target menu lets you store the changes in an external user dictionary or in any open document.
    In the Dictionary List menu, choose Added Words.
    In the Word box, type or edit the word to be added to the word list.
    Click Hyphenate to see the word’s default hyphenation. Tildes (~) indicate possible hyphenation points.
    If you don’t like the hyphenation points, follow these guidelines to indicate your preferred hyphenation of the word:
    Type one tilde (~) to indicate the best possible hyphenation points, or the only acceptable hyphenation point, in the word.
    Type two tildes (~~) to indicate your second choice.
    Type three tildes (~~~) to indicate a poor but acceptable hyphenation point.
    If you want the word never to be hyphenated, type a tilde before its first letter.If you need to include an actual tilde in a word, type a backslash before the tilde (\~).
    Click Add, and then click Done. The word is added to the currently selected Dictionary List.
    Note: Remember that hyphenation points interact with the hyphenation settings in your documents. As a result, the word might not break where you expect it to. Control these settings by choosing Hyphenation in the Paragraph panel menu.
    By default, hyphenation and spelling exceptions are located in user dictionary files stored outside the document on the computer where InDesign is installed (dictionary file names end with a .clam or .not extension). However, you can also store exception lists inside any InDesign document. In addition, you can store word lists in an external user dictionary, in the document, or in both. The location of existing dictionaries appears in the Dictionary preferences.

  • Coldfusion MX Verity Search Term With Hyphen

    We are using verity to create and search collections.  The text in the collections includes words with a hyphen (patient-centered) but when searching on patient-centered we don't find any results.
    Is there a way to search on words with hyphens?
    Thanks for the help.

    The application is on CF MX (version 6).  Unfortunately, I cannot upgrade it to CF 8 (due to client's funding).
    If you go to www.fmdrl.org and search on South-Paul (author's last name) you won't get any results (though you should).  Search on South Paul (no hyphen) and you will get results.
    Thanks for the assistance.

  • Lyrics - problems with split-syllable words.

    When entering lyrics in Logic Studio 8, the manual tells me to press SHIFT-TAB to get the lyric tool to line up under the second half of a tied note, so that, for instance, I can enter something such as "Glo - ria"
    with the dash which splits the word lined up underneath the second part of that tied note.
    This worked fine in my earlier version.
    When I do this now, as it tells me to in the manual, all that happens is that the last word/syllable I have typed starts to flash!
    What, if anything, am I doing wrong? It is very frustrating,as I work extensively with lyrics/songs.

    There are lots of little things like this that don't work in Logic, unfortunately. And since no one knows when an update will be issued, or, if such an update will even address the problem, my best suggestion is that you find a workaround. Otherwise you'll simply grow old and frustrated. The been-there-done-that-got-the-t-shirt text-entry hyphens are my best suggestion.
    FWIW, when I'm doing lyric entry, I'll have the pencil tool set up on the CMD key. As I'm sure you know, selecting the lyric item in the score editor palette prior to using the pencil tool will ensure that the pencil retains its lyric-entry function until another palette item is selected. I also have two key commands set up to do:
    • select pointer tool (arrow)
    • select text tool
    On my system, it's "W" and "E" respectively. So... when I want to enter lyrics, I hold down the CMD key and start lyric entry. TAB gets me to the next actual note. When I need to add a hyphen, I simply hit "E" and voila, I get the text tool and enter it. When I'm done, I hit "W" and I'm back to the pointer tool. The pencil tool remains on CMD. By keeping the main tool as the pointer/arrow, I'm always at-the-ready to rubberband a bunch of lyrics+text and use another handy key command to align it all (align vertically).
    Anyway, HTH.

  • How to use GREP to find one particular word with automatic hyphen?

    I know I have in my text a word with automatic hyphen on the end of line, say Wo-rd.
    How can I find it?
    Thanks.

    I think you might do better to edit the hyphenation in the Dictionary.
    One reason words hyphenate incorrectly is the wrong language has been applied. Both spell checking and hyphenation rules are governed by the language selected for the text, and language is a character-level attribute so that you can select inidvidual words and assign a different language to them if you like.
    If that's the probelm here, you can look for the word using find/change (without worying about the hyphen) and change the language for all instances.
    In either case you will be far better off fixing the problem on a global scale in the document than you will be finding a particular instance of that word at the end of a line. Any editing you do in the future may cause the problem to reappear somewhere else.

  • Add a new directory with hyphen (-) in the domain name

    Dear All,
    I'm trying to add a new directory with hyphen (-) in the domain name (default domain *.onmicrosoft.com). As a result I keep getting a validation error: "The domain is not unique". I've tried several
    combinations with really awkward words and a hyphen. Such domain names must be unique. I think that the error message is misleading.
    Is it a well known behavior? Is it possible to use a hyphen in the domain name?
    Thank you for your help,
    Artem

    Dear Arvind,
    Thank you for your effort and time in validating the described behavior.
    According to the
    Regexp for subdomain question on SO, 'Each subdomain part may contain hyphens (dashes), but may not begin or end with a hyphen'. That been said, the validation error, on your screenshot is appropriate. On the other hand, the validation error
    with a hyphen (dash) in the middle is misleading.
    It's not a big deal, since people most likely use a custom DNS name anyway.
    Kind regards,
    Artem

  • Vb 2012 use regex to substitute specific key words with specific replacements

    I am creating a VB 2012 application in which I have a two-dimensional array containing a collection of specific (but case-insensitive) key words with their replacement words.  I also have a very large series of String variables which I read sequentially
    from a .CSV file.
    What I want to do is to efficiently parse each String variable searching for any occurrence(s) of the Key words held in the array and substituting with their replacement.
    I know I can use "standard" VB code to do this but my instinct tells me that using Regular Expressions might be far more efficient.
    Never having attempted to use Regular Expressions before, but having just spent several hours attempting to research the subject online, I know I need some help, please.
    Any advice or guidance will be gratefully received.
    Paul J

    Hello,
    The 'Suggestions and Feedback for the Forums' forum is to give users a voice on Forums. Users can give suggestions for improvements or vote up suggestions and know that the Forums team is listening.
    I'd ask in the
    Visual Basic .Net Language forum on MSDN.
    Karl
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book:
    Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

  • Mac Mail Typing Glitch With Hyphen

    Using:
    Mac Book Pro (Retina, Mid 2012)
    Processor 2.7 GHz Intel Core i7
    Memory 16 GB 1600 MHz DDR3
    OS X Yosemite, Version 10.10
    Mail Version 8.0
    Typing words with a hyphen such as "I'll" or "We've" or any hyphen causes the cursor to move in reverse one letter so the text typed separates the letters following the letters following the hyphen.
    This is an aggravating glitch with the new version.
    Anyone else with this problem and are there any work arounds or repairs?
    Thanks for any suggestions, David

    Log out under the Apple in the Menu bar.
    Log in with Shift key down. (This disables all login items)
    If the problem goes away it's a conflict with one of your login items.
    Still have issue? Restart in Safe Boot mode.
    Safe boot
    *  shutdown
    *  start the Mac and *wait* for the startup chime to sound
    *  after the sound, press and hold down the shift key
    *  keep holding and *wait* until the grey  Apple logo appears
    *  now release the shift key and just wait (it could take a few minutes)
    *  eventually the login screen appears with the words SAFE BOOT
    *  continue to login to see if the problem goes away.
    Validate your Fonts
    How to use Font Book to validate fonts
      1. Open Font Book in your Applications folder.
      2. Select All Fonts.
      3. Now click in the list of fonts and select all (Edit > Select All).
      4. Under File in the Menu bar, select Validate Fonts.
      5. Duplicate fonts will be marked with either the yellow badge or a black dot.
      6. Select to remove or delete duplicates.*
      7. Delete font caches
      8. Restart your computer
    * Step 6 – remove or delete duplicates is where the tricky part comes in. You can select to let Font Book disable or remove duplicates, but I’ve found that it removes the one you have not been using rather than selecting the best option. See Font Management in OS X, by Kurt Lang, for more info on fonts.
    http://www.jklstudios.com/misc/osxfonts.html
    See Kurt Lang's directions here to remove font caches
    https://discussions.apple.com/message/26188553#26188553
    Let me know if you still have issue and we can do further steps to resolve.

  • I have Words with Friends app on iphone and game on computer.  When I try to play with Facebook friends message says" Account Already Connected.  This Facebook account has been connected to another user."  How can I play game on iphone or my pc?

    I have Words with Friends app on my iphone4S and the same game on computer.  When I try to play Words with Friends with Facebook on the iphone the  message says" Account Already Connected.  This Facebook account has been connected to another user."  It is connected to my computer. How can I play game on iphone?

    Hi Grandmaz5,
    If you are having issues connecting to Facebook on your iPad, and you have already troubleshot the Facebook app itself, you may want to check the built-in iOS settings for Facebook; you may find the following article helpful:
    iOS: Using Facebook, Twitter, and other social network accounts
    http://support.apple.com/kb/HT5500
    Regards,
    - Brenden

  • I am trying to download words with friends app and it says it is no longer available from itunes.  I had already downloaded it and did a update in my I phone 4 and it is still not letting me download it?

    I am trying to download words with friends and itunes is saying it is no longer available for purchase.  What is going on??I

    First you need to research all the problems people are having with the higher OSX versions, & make sure you have a bootable clone of what you have just in case.
    then you must get 10.6 if they still have it, install it & update to 10.6.8 so you have the App Store to buy & download the huge 10.8 Installer.
    Snow Leopard/10.6.x Requirements...
    General requirements
       * Mac computer with an Intel processor
        * 1GB of memory (I say 4GB at least, more if you can afford it)
        * 5GB of available disk space (I say 30GB at least)
        * DVD drive for installation
        * Some features require a compatible Internet service provider; fees may apply.
        * Some features require Apple’s MobileMe service; fees and terms apply.
    Which apps work with Mac OS X 10.6?...
    http://snowleopard.wikidot.com/
    It's been pulled from the online store & Apple Stores, so you have to call Apple to buy it, last I heard.
    Call Apple Sales...in the US: 1-800-MY-APPLE. Or Support... 1-800-275-2273
    Other countries...
    http://support.apple.com/kb/HE57

  • I am trying to use Words with friends on my iphone 5.  How do I get rid of   "Connect to itunes to Use Push Notifications

    I am trying to use Words with friends on my iphone 5.  How do I get rid of   "Connect to itunes to Use Push Notifications

    Reading some older threads from 2012 and 2011 it appears the problem was present even then.  Part of the problem was due to people using multiple or different account id's on the various devices.  In my case, I only have one ID and it is the same on all devices yet the iPhone and iPad are still throwing the same error when I try turning on iTunes Match.  This is very frustrating . . . any help out there?  Thanks.

  • I am getting a "invalid screenshot" when trying to upload the screen shot to a Words With Friends cheat app.  It just started doing this!

    I am getting a "invalid screenshot" when trying to upload the screenshot to a Words With Friends cheat application.
    What am I doing wrong?

    That was no help!  When playing with two grown daughters with high IQs,
    I need all the help I can get!

  • Firefox stops responding when I try to play words with friends, eventually a box pops up about script

    First, let me say I have the latest version of Firefox and Adobe Flash Player and Java Script. When I click to play Words With Friends (on pc) my computer starts racing and sounds loud and every thing freezes. If I try to click on slider or anything else, it says Mozilla Firefox (not responding), then it takes several minutes and a box pops up that says something about a script, do I want to continue or ?(I can't remember), after I click continue, I can play the game, but, at any given time Firefox will stop responding again!! A box also pops up from AVG saying that Firefox is using too much memory. Just an aside, I can play Scrabble on Facebook without any problems whatsoever. Please help, it is driving me crazy. Thanks

    Sounds that you are missing the plugin that is used to play those videos embedded in Firefox.<br />
    Your system details list doesn't show any media player plugin, so you will either have to check if the plugin(s) are installed, but disabled or install missing plugins.
    *https://support.mozilla.org/kb/Popular+plugins
    You may need the new WMP plugin (np-mswmp.dll) because Flash always uses a dedicated player to play the videos and would never offer to save videos directly unless an extension is used.
    * https://support.mozilla.org/kb/Using+the+Windows+Media+Player+plugin+with+Firefox
    * http://kb.mozillazine.org/Windows_Media_Player#Missing_plugin

  • I don't know how to go back to the original look of my Dashboard. I don't know what I did, but now when I click on it, my Words with Friends game comes up and that is all. How do I "reset" it to the original things on it?

    I don't know how to go back to the original look of my Dashboard. I don't know what I did, but now when I click on it, my Words with Friends game comes up and that is all. How do I "reset" it to the original things on it?

    Firefox 4 requires at least OS X 10.5 and an Intel Mac.
    * http://www.mozilla.com/firefox/4.0/system-requirements/
    You can look at:
    * http://www.floodgap.com/software/tenfourfox/
    Firefox 3.6.x can be found here:
    * http://www.mozilla.com/en-US/firefox/all-older.html

  • Question about "words with friends" rules-can more than 1 person play on the same Ipod device?

    I have a Ipod touch 5th Generation and I like to play the free game version of "Words with Friends"  Can other family members in my house sign up to play on my Ipod using a different user name?  I have tried to figure this part out and there's no clue available on the "Words with Friends" website.  Thanks for your help again!!!  I also have music on my computer that I would like to transfer to the new Ipod.  How do I do that?  I haven't been able to link it to "Itunes" yet, and then sync it to my Ipod. 

    Well, E3000 doesn't support any usb port replicator. So, in case if you want to use any hard drive you need to connect it directly to the router.

Maybe you are looking for