Regex: for any word, find word+s and y/ies

Hi all
This sounds pretty simple, but I'm trying to create a regular expression whereby, for any word, the matcher will find all instances of that word OR it's plural.
Now, if it were just adding +s, I know I could do Pattern.compile("\b\Q" + word + "\Es?\b");
   // note, this forum seems to spaz when I use double-slashes, so I omitted themHowever, if it ends in a "y", like "try", I need to find words that end in "ies", like "tries".
At first I thought of making two cases in the pattern, one as above, and one were the last letter is subtracted and you check for (y|ies). HOWEVER, without first knowing if the word ends in a "y", it could take "do" and change it into "dies", and then mistakenly find it.
Of course, I COULD have a whole bunch possible patterns seperated by a bunch of IF-THENs... "if it ends in a y, Pattern pattern = Patern.compile(...."
... but this doesn't seem very elegant.
So, how can I create a pattern that will check for "ies" ONLY if the word ends in "y" (and +"es" if it ends in an "s" and so on...)?
Thanks!
Tim

<div class="jive-quote">
<span class="jive-quote-header">uncle_alice wrote:</span>> ... but this doesn't seem very elegant. If you really want to do it right, you'll use a stemming algorithm, but if you stick with regexes, the brute force approach you've already outlined is as elegant as it gets.
</div>
You'll also need a stronger definition of plural. I don't know how in-depth you need this to be, but some words are pluralized by adding "es" or "ues", some by changing "us" to "ii", etc. I really can't see how using regex is going to make this easier.

Similar Messages

  • Solution for spotlight not finding all files and plea to apple...

    ok, here is the deal:
    you are looking for a file named "new_template.lso" which is a logic song template, that you created with logic studio.
    this file resides in ~/Library/Application Support/Logic/Song Templates/ a location where logic insists on putting the song templates.
    looking for it via the spotlight menu shows nothing.
    looking for it with the finders search reveals ... nothing. *** ?
    here is the wonderful solution:
    -open a new finder search: cmd-f.
    -goto the first dropdown menu
    -choose "others"
    -look for "system files" check the corresponding box.
    -go back to the search window and search for the file - no result
    -now go to the first dropdown menu and choose the newly added "system files" entry.
    -finally go to the second dropdown menu and choose "contains".
    boom, totally easy and fast and user friendly... you got your file.
    this solution isn't even possible in the spotlight menu!!!
    so why am i not supposed to find files in my user library?
    i am 32 years old.
    i use my computer to make a living.
    i used macs since 10 years.
    i promise i will not sue apple if i find and delete files by mistake.
    seriously this dumbing down the system starts to get unbearable.
    does anyone know of a workaround?
    are there any hidden preferences for spotlight, which i could change so it shows "system files" by default???

    I completely agree. Everyone who has a problem with this (and I see it is a hot topic in these forums) should send apple a a note and tell them that we don't all stick to iLife and some of us go into the LIBRARY. Leopard is great, but Tiger let me efficiently find stuff in the library and I was always confident I'd find all I needed.
    Send your comments here to apple feedback. http://www.apple.com/feedback/macosx.html/

  • Help! Need to prove I DIDN'T delete photo(s) from iPhone, could save me from jail. How can I do this? Thanks for any help, I'm innocent and need to show this.

    This could save me from jail.  I need to prove that I DIDNT delete one or more photos from my iphone.  Is there a hidden numbering system that will show if some are missing?  Here's what happened:
    I went from point A to point B, and I took photos at both places. I was arrested for allegedly taking a detour in between A and B to take one or more photos on my iPhone, which I did NOT. The sequence of photos on my iPhone shows this (photos from A and then B with nothing in between), but my false accuser will just claim I deleted the ones in between (to have me imprisoned falsely. long story).
    I am innocent and I'm hoping my iPhone can prove that.  Any help is MUCH appreciated.
    Oh, and I haven't synced the phone since this happened, if that's an issue.

    A managed library is the default type that iPhoto creates.  Make sure you have the option selected to copy photos into iPhoto when importing:
    was hoping it would at least keep thumbnails of all my photo's.
    I use a DAM (digital asset management) program which will do exactly what you want: Media Pro 1.  It creates catalogs (libraries) of thumbnails, up to 640 x 480, that is uses to manage the photos.  You can do anything to the photos except edit, slideshows, or anything that requires the full source image when the source files are not available.  You can arrange  photos in Catalog Sets (like iPhoto albums), add keywords, etc. to them even when the sorce files are not available.  When the source files are available you can write that metadata to the source file and rename files. You can use Media Pro in demo mode for about a month I believe. 
    A catalog file for 44,000 photos (178 GB) with the thumbnails set for 320 pixels at high resolution is only 1.5 GB. The larger the thumbnail selected the larger the catalog file will be. 

  • I get the following error message whenever I try to access email from Dice JobAlert. I don't receive the error for any other email I receive and I also don't get the error message when I access the email using Internet Explorer.

    This is the error message I received: A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script will complete. Script: http://sz0150.wc.mail.comcast.net/zimbra/js/Startup1_2_all.js.zgz?v=110527090709:822

    Their browser detection script is out of date. The warning seems to come from this file: http://virus.info/api/load/file/js , specifically, the badBrowser() function.
    It's checking for "Firefox/1", which it finds as part of "Firefox/10".
    Perhaps point them towards this blog post: http://hacks.mozilla.org/2012/01/firefox-goes-2-digit-time-to-check-your-ua-sniffing-scripts/

  • How do I move an account to the top of the column of accounts? I have version 31.3. Thanks for any help you can offer and Happy New Year!

    I see that my Thunderbird account listings (in the leftmost column) are alphabetical. I want to move the bottom listing to the top. Is this possible? I'm using Windows 7. Oh, and did I mention Happy New Year?

    Try this add-on:
    https://addons.mozilla.org/en-US/thunderbird/addon/manually-sort-folders/
    http://www.ramsden.org.uk/3_How_to_install_Add-ons_in_Thunderbird.html

  • Can I download documentation for any product?

    Hello
    Is it possible to download documentation (HTML) for any product to my harddisk and view them offline? I don't have a persistent access to internet.

    I don't think you can download a zipped up version of the HTML, but you could always download the PDF files you're interested in. You can also order the Oracle8i or Oracle9i Documentation CD from the Oracle Store at http://store.oracle.com.
    Alison

  • I recently upgraded to Lion and i find that my computer is running slow and applications are crashing.  For example I have Word 2011 for Mac and it crashes all the time I end up losing my work.  It often happens when I'm in notebook trying to record.

    i recently upgraded to Lion and i find that my computer is running slow and applications are crashing.  For example I have Word 2011 for Mac and it crashes all the time I end up losing my work.  It often happens when I'm in class using notebook and when I press record my computer starts thinking and it freezes.
    Also, I feel that it overheats often and my battery runs out pretty quickly.  I had the macbook (black) and this never happened before.  I'm not sure if I'm doing something wrong or if there is something with my computer.I bought my computer summer 2010, I don't think this should be happening. Please Help......

    This is exactly what keeps happening to mine too.  I was at a conference taking notes, and I was
    using the Notebook template, and doing some audio recording simultaneously.  About 3 hours into the conference (not consistently recording, but on and off with the sessions) my file wouldn't save anymore, saying something like "File cannot be modified while in use with another program" and "Invalid file name" when I would go back into my folder to look for it). I tried installing some updates from Microsoft, and when I restarted, I was at least able to open my old notes again, and so far it looks like the audio was working.  However, today at the conference, the same thing happened again, but I wasn't actively recording any audio (though after I had copy and pasted my second file of notes into the original, I went back to using it after re-naming it). 
    Does the crash happen to you under similar cirucumstances?  The update might help a little, but it is definitely not the solution.  Does anyone have any solutions?  Lion shouldn't be this buggy... I moved to Mac to get away from the garbage of bugs and compatibility issues...

  • Using OS X 10.6.8 on my IMac, I find that items on my message list no longer "fade" from dark to light when I click on them. I recently switched the font from Arial to Helvetica to permit me to select italics for any word. I am composing in rich text.

    Using OS X 10.6.8 on my IMac, I find that items on my message list no longer "fade" from dark to light when I click on them. I recently switched the font from Arial to Helvetica to permit me to select italics for any word. I am composing in rich text.

    Not sure why it would default to IMAP?  But any how, start the account anew, fill in the first page of info, but before clicking on the Create button, hold down the Option key until the Create button changes to read Continue.  Click continue, and proceed in a more manual process during which you can set the account type as POP.
    Ernie

  • I downloaded updates for "Office for Mac" a few days ago and it won't finish.  It keeps saying I have to close Safari, Microsoft Word and Microsoft Powerpoint and I don't have any of these open.  Can anybody help me?

    I downloaded updates for "Office for Mac" a few days ago and it won't finish.  It keeps saying I have to close Safari, Microsoft Word and Microsoft Powerpoint and I don't have any of these open.  Can anybody help me?

    Hi Anne,
    Did you do this through one of the Office app updates, or did you download it directly from the Microsoft website?
    Whichever way you tried it, I would try it the opposite way this time, although simply repeating what you did before may also work.

  • Can't find where the automated suggestions for misspelled words can be edited, and yes I googled it.

    I typed "vrey" and "very" wasn't suggested. Really? It's something I thought would be easy to find in the options but it isn't for some reason, maybe I'm blind.

    #Add a dictionary
    #*go to the Firefox Add-ons page --> https://addons.mozilla.org/en-US/firefox/
    #*on the Add-ons page, click "More..." just under the large type "Add-ons" and choose "Dictionaries and Language Packs"
    #*find the language and click "Install Dictionary" on that line
    #Adding words to your personal dictionary
    #*Read all of the following section of this article ("Add to Dictionary" will be below the suggested list of words on the right-click/context menu) --> https://support.mozilla.org/en-US/kb/Using%20the%20spell%20checker#w_correcting-misspelled-words (''also read the entire article'')
    #*Also see --> http://kb.mozillazine.org/Spell_checking
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''
    Not related to your question, but...
    You may need to update some plug-ins. Check your plug-ins and update as necessary:
    *Plug-in check --> http://www.mozilla.org/en-US/plugincheck/
    *'''''Adobe Shockwave for Director Netscape plug-in''''': [https://support.mozilla.org/en-US/kb/Using%20the%20Shockwave%20plugin%20with%20Firefox#w_installing-shockwave Installing ('''''or Updating''''') the Shockwave plugin with Firefox]
    *Adobe PDF Plug-In For Firefox and Netscape: [https://support.mozilla.org/en-US/kb/Using%20the%20Adobe%20Reader%20plugin%20with%20Firefox#w_installing-and-updating-adobe-reader Installing/Updating Adobe Reader in Firefox]
    *Shockwave Flash (Adobe Flash or Flash): [https://support.mozilla.org/en-US/kb/Managing%20the%20Flash%20plugin#w_updating-flash Updating Flash in Firefox]
    *'''''Next Generation Java Plug-in for Mozilla browsers''''': [https://support.mozilla.org/en-US/kb/Using%20the%20Java%20plugin%20with%20Firefox#w_installing-or-updating-java Installing or Updating Java in Firefox]

  • Finding Words with more than Two Vowels (Regex)

    Hello all, I've been working on this for quite some time now.  I need to use a regular expression to find words that contain more than two vowels.  I am getting stuck.
    Here is what I have so far.  I am using emacs to find them in a text file.
    I use C-M-s and the expression /<[^aeiou]*[aeiou][^aeiou]/>
    It finds words with one vowel, but I need to find if it has more than two, and I'm not sure how to go about doing that.
    Any help is appreciated!

    alphaniner wrote:
    This better not be a homework question...
    [aeiou].*[aeiou].*[aeiou]
    or, more succinctly (I think...)
    \([aeiou].*\)\{3\}
    I tested it with grep on a file with one word per line.  Seems to work in that context.  More than one word per line and it breaks.  I know nothing of emacs or your data, so I have no idea if it will suffice.
    I'd also suggest you go back over your expression and put into words exactly what you think it is doing.  I'm no regex expert, but it doesn't seem at all fit for what you're trying to do.
    Thanks that seemed to work!

  • RoboHelp 8 vs. 9 - Search Functionality Comparison and "All of the Words" vs. "Any of the Words"

    Greetings!
    Our organization focuses a lot on the accuracy of our searches, which is a necessity when we have hundreds of very lengthy topics (no matter how well organized they are).
    I finally completed a detailed comparison of the search functionality of 8 and 9 and came to the realization that 8 is a disaster, while with 9 things get better, but there's still TONS of room for improvement.  I have reported this to Adobe and so far there has been no official response. There are many blogs on here related to the search functionality, but I thought it may be a good idea to try to sum some of them up. I do hope that someone somewhere at Adobe runs into this and shares with all of us why Adobe's Search functionality is still in the 20th century!
    I hope this helps everyone else who is curious to know about how the tool's search functions work and whether it's worth upgrading from 8 to 9 at this point. I have included some examples which are in a way internal to us, but they will give you a good idea of what to expect and I'm quite confident you'll be able to recreate them on your side in seconds.
    I also wanted to ask a question or two, and if anyone can assist, that would be greatly appreciated:
    Currently if we search for several words at once (not exact phrase), both 8 and 9 perform an "Any of the words" search which always returns too many results. Does anyone know a way to change the default to an "All of the words" search? For years I have not encountered a tool out there that doesn't have the option to modify this, alas with RoboHelp 8 and 9, we can't find a way to do it (with or without modifying the source code).
    Out of curiosity, are there any other tools out there which offer Conditional Tag (or similar) functionality and which behave better than RoboHelp? (easier to maintain, less buggy, web interface, etc)?
    RoboHelp 8 vs 9 - Search Functionality Comparison Table with some Examples:
    Search Example              
    RoboHelp 8     
    RoboHelp 9        
    Expected Results
    (based on industry standards)
    1. Searching for Exact Phrase "Correspondent Banking"
    Such a search returns topics which contain "Correspondent Banking" and "Correspondent Bank". The last one is included because "Bank" is the root of "Banking". The topics that contain the exact phrase appear at the bottom. When we click on any of them, we're not automatically taken to phrase so we have to scroll and look for it or use CTR+F.
    Identical behavior except that when we click on the topics which contain the exact phrase, we're taken straight to it.
    When we hear "exact" we expect "exact" and nothing else. Unfortunately, both versions keep searching for the roots of each word as well and incorrectly display those results at the top. Adobe has made it clear that this is a part of their functionality, BUT this is something we would not expect to see for exact phrase searches that are in quotes.
    2. A Non-Exact phrase search of "Geographical Limits of market area"
    The tool automatically performs an "Any of the Words" search instead of an "All of the Words" search. This is also related to the question I asked above this table. As you can imagine, this is returning almost every topic and it becomes virtually impossible to find what we're looking for. It even returns topics which contain "of" and nothing else.
    Identical behavior
    There to be an option which allows us to choose what the default search would be - "Any of the words" vs. "All of the Words"
    3. Exact Phrase search of "low-score" with a dash
    None of the topics that were returned contain the phrase. As some of you know, RH8 has problems with special characters, including dashes.
    RH9 returned only the topic that which contains the phrase and we were taken straight to it when we open it.
    The expectation is to see exactly what RH9 currently offers. Unfortunately 8 has a big problem with these types of searches.
    4. Exact Phrase search of "2.4"
    This is similar to the one above. Adobe doesn't like periods as well. It doesn't not find any of the topics which contain this phrase. In our case, this is a section number and sometimes people want a quick way to get to a specific section or sub-section.
    We were hoping that this will be fixed with 9, just the way they fixed the dashes. Unfortunately, still ZERO results returned.
    Expectation is for the topics which contain that exact phrase to be returned, no matter whether there's any special character inbetween.
    5. Exact Phrase search of "300,000" or $300,000"
    The tool only returned several random topics which contain "000" as part of larger numbers. The topic that contains "300,000" was not on that list, even though it also contains "000".
    Identical behavior
    Expectation is for topics that contain the exact amount to be returned, no matter if there is a coma or a dollar sign anywhere within the phrase.
    6. Exact Phrase Search of "525-B5". Goal was to have a special character, a letter and numbers.
    ZERO Results returned.
    Only the docs that contain the phrase were returned and nothing else. It seems that this this was addressed in version 9 and now it behaves as expected.
    Expectation is only for the docs that contain the exact phrase to be returned.
    7. Exact phase search of "log" in order to test the Substring Functionality
    Here's an extract from Adobe's Support Site:
    “Substring search (WebHelp/Pro, FlashHelp/Pro) - If you enable this feature, a search for "log" returns topics containing the words "catalog" and "logarithm." Substring search takes longer than whole-string search.”
    So with that in mind, we decided to test if turning the substring searches on and off does exactly as advertised, unfortunately the answer was NO. We even used an example almost idnetical to what Adobe provided on their site.
    With Substring Searches disabled, we searched for the word "log". Unfortunately it returned words like "logbook" and methodology". How is that possible?
    Identical behavior
    Our expectation would be only for docs that contain"log" to be returned, no matter whether substring is enabled or disabled. In our case it was disabled.

    Hi there
    Out of curiosity, why is it that you expect to hear from Adobe? I'm hoping it's not simply because you posted here. Certainly we have Adobe folks that visit here and we are thankful for that, but it isn't to be expected.
    Cheers... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7, 8 or 9 within the day!
    Adobe Certified RoboHelp HTML Training
    SorcerStone Blog
    RoboHelp eBooks

  • Auto-Capitalization: How can I set Pages v5.01 to auto-capitalize the first letter of the first word in a sentence and to automatically change lower case "i" to "I" appropriately. I'm unable to find a menu that offers me these.

    Auto-Capitalization: How can I set Pages v5.01 to auto-capitalize the first letter of the first word in a sentence and to automatically change lower case "i" to "I" appropriately. I'm unable to find a menu that offers me these.

    Gavin Lawrie wrote:
    Once it had been established that the iWork rewrite had resulted in some features being lost and others broken, and once Apple had acknowledged the concerns* and suggested they are working on fixes**, I'm not sure what else there is to achieve.
    You are writing that in the perspective of having read about it here already. Repeated often enough that you encountered it somewhere in the posts.
    Users are flooding in here and don't know any of this. Of course we have to repeat everything endlessly.
    Because I like to give precise, understandable and workable answers to repeated questions, and Apple doesn't allow sticky posts here, I created a separate forum which users can consult to look up real answers, and contribute for themselves if they have something valuable to add:
    http://www.freeforum101.com/iworktipsntrick/
    There is a section purely devoted to Pages 5. Add whatever answers you feel will lighten the problems of Apple's 'upgrades'.
    Peter
    * Where have they acknowledged anything?
    ** They have barely anything listed, compared to the massive list of deleted features, and nothing but an extraordinarily long time frame considering they created the problems here and now. Apple has not said they will do anything at all about fixing the real issues, the biggest of which is that the new iWork apps break virtually all the work of existing users.

  • How can I search a pages document for any of a string of words?

    I am a teacher and would like to search some short stories for vocabulary that I think will help my students get ready for the SATs one day. I have a long list of SAT vocabulary, close to 1,000 words, and I'm wondering if there's any quick way to just put those words into the Find menu and have it search for ANY of those individual words, rather than the whole string. Is that possible?
    Also, info on the arrival of the next version of iWork ('13?) would be awesome.
    Thanks.

    Locating and Searching Comment annotations.
    From the open Comments List you can sort and filter comments.
    This is discussed in Acrobat X Pro's online Help:
    http://help.adobe.com/en_US/acrobat/pro/using/WS58a04a822e3e50102bd615109794195ff-7e42.w.h tml 
    A sorted / filtered list can be used to generate a PDF comment summary report.
    http://help.adobe.com/en_US/acrobat/pro/using/WS75E00763-F15A-43a1-85B7-51B920B1181A.w.htm l
    You could then use Find on the output summary report.
    Using Acrobat X Pro you can embed an index in the PDF.
    http://help.adobe.com/en_US/acrobat/pro/using/WSC28D4DBB-6A78-4027-9E04-F50FE411CFB9.w.htm l
    Then use the Search tool. With the Search pane open tick "Include Comments".
    Search returns have an icon at the left of each instance.
    This portion of Acrobat X Pro's online Help shows and describes these.
    The third up from the list's bottom is the Comments icon.
    http://help.adobe.com/en_US/acrobat/pro/using/WSC28D4DBB-6A78-4027-9E04-F50FE411CFB9.w.htm l 
    One of these or combinations may met your needs. 
    Be well...

  • The "sign in" button does not appear and my library, account, etc. don't launch automatically upon launch. What am I doing wrong? Thanks for any help you can provide. (After two hours of trying to find a way to contact Apple on this issue, I gave up.)

    Hi. I am really frustrated with Apple support. After two hours of trying to navigate their support site, I finally gave up. I really hope someone here will be kind enough to help me find a solution to my problem.
    My iTunes always launched with my account, my library, etc. present. Now it launches in a generic form with none of my information present. It also has no "sign in" area so I can get to my data. I'm not sure what happened, can anyone help?
    Thanks so much for any assistance you can offer.
    Joe

    I've not noticed this but haven't looked for it either - I suspect you are seeing 'normal' behaviour for AppleTV 2/3 - in other words it's ignoring the iTunes flags.
    With AppleTV 1 I used to set playback start/end times using Get Info in iTunes for certain self-indulgent music videos I'd bought which had several minutes of 'acting dialogue' you'd only endure once - this allowedme to shuffle music videos with only the song part of the video being played not all the waffle before the song started.  AppleTV 2 and 3 ignore this setting.
    Also, with AppleTV1 if you unticked the check box next to stuff you never wanted to stream AppleTV would behave as expected and not display it at all - useful for preventing non-family friendly material from streaming in the first place or  excluding seasonal material and do forth.  AppleTV 2/3 completely ignore the checkboxes on iTunes ans stream everything though you can of course enable parental controls.
    Hard to know if it's the AppleTV's ignoring the info or iTunes not sending it to them in the first place.
    Either way send feedback to Apple here:
    Apple - Apple TV - Feedback
    They won't answer but it may get put on a 'to do' list if enough users complain.
    I'm still waiting for AppleTV 2/3 to handle iTunes LP and iTunes Extras!
    AC

Maybe you are looking for

  • How to make Firefox to never update that slow custom look since FF 29?

    How to make Firefox to never update that slow custom look since FF 29? How to change windows installation and ubuntu installation so they never update after FF 28 witch was last normal speed normal browser? Hello. I can easy remove on Windows FF 29 o

  • "Archive All" is disabled

    I have a Sony Bloggie MHS-PM5 and when I plug it in and use iMovie to import, the "Archive All" button is disabled. Anyone know why?

  • Disable .swf (Flash File) Generated as an Attch in Email Delivered byIBOT

    .swf Adobe Flash file is generated when i am scheduling an IBOT to the user , In the IBOT i am delivering an Answers request and i can access the answers request and ATT288***.swf File is generated as an attachment , How can Disable that file from ge

  • Problems Sharing Movie to QuickTime

    Camera: Panasonic PV-GS500 iMovie: 6.0.3 (267.2) In the past, I've successfully made movies with this camera and iMovie 6. I've also successfully converted them to QuickTime and also transferred them to VHS using a Canopus ADVC 110. I used iMovie to

  • Answer the following questions

    Kindly please answer the following the questions and explain them as detailed as possible. Thanks! (I)True/False (1)HAVING to exclude rows from a query, Use WHERE to exclude group. (2)You can only have a subquery in a FROM/ WHERE/ HAVING clause of a