Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • $\begingroup$ Agreed.//////// $\endgroup$ Commented Oct 7, 2024 at 20:29
  • $\begingroup$ Thanks - I might not have posted this cheeky response if I had read your entire answer above. $\endgroup$ Commented Oct 7, 2024 at 21:15
  • $\begingroup$ (+1) Won't you have to Map onto myStrList, or the like? (such as Select[StringCount[#, _?LetterQ] == 1 &] /@ StringSplit[myStrList]) $\endgroup$ Commented Oct 7, 2024 at 22:31
  • $\begingroup$ The StringSplit method seemed inelegant to me because it's destructive. For example, StringSplit["This is A 123a Test"] and StringSplit["This is A 123a\n Test"] return the same list because, by default, StringSplit splits the string at all whitespace characters. In the general case, in which the list has more than one whitespace character (or more than one whitespace type) between "words," it doesn't seem straightforward to reverse the split and obtain a processed version of the original string. I didn't request that in my original post but it seems like something one might want. $\endgroup$ Commented Oct 10, 2024 at 15:16
  • $\begingroup$ The StringSplit method also seemed inelegant to me given how many tools, including WordBoundary, the Wolfram language provides for working with patterns and string patterns. I assumed I was missing some simple solution using such tools. So I was honestly surprised by the relative verbosity of a solution using the pattern/string pattern approach (see Syed's answer; this is in no way a criticism of that answer!). $\endgroup$ Commented Oct 10, 2024 at 15:30