Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: substrings at the end of words

  • To: mathgroup at
  • Subject: [mg55046] Re: substrings at the end of words
  • From: Bill Rowe <readnewsciv at>
  • Date: Thu, 10 Mar 2005 05:25:09 -0500 (EST)
  • Sender: owner-wri-mathgroup at

On 3/8/05 at 6:42 AM, akoz at (Andrzej Kozlowski) wrote:

>On 8 Mar 2005, at 11:03, fartous at wrote:

>>a = {"edit", "listed", "called", "wedding"} StringCases[a, _ ~~
>>"ed"] Out[]= {{}, {ted}, {led}, {wed}} i want to extract only the
>>"ed" string which located only at the end of the words, i could
>>not do that using the above code. thanks jack

>a = {"edit", "listed", "called", "wedding"};


This solution outputs the entire word instead of what the original poster indicated and misses the case when the pattern isn't at the end. The following outputs what the original poster requested

a = {"edit", "listed", "called", "wedding"}; 
  StringReplace[a, RegularExpression["([a-z]ed)[a-z]+"]->"$1"], 

{{}, {"ted"}, {"led"}, {"wed"}}
To reply via email subtract one hundred and four

  • Prev by Date: Re: RationalApproximation
  • Next by Date: Re: symbolic approximation (formular manipulation)
  • Previous by thread: Re: substrings at the end of words
  • Next by thread: Re: Re: substrings at the end of words