2

I'm a teacher in primary school. There is a list of words my pupils will have to learn during their first 2 years. But of course in the beginning they only know a handful of letters. So I'm looking for an easy way to go through that list and display only those words that only contain the letters "a, m, l" or whatever. Can you help me find a way to do this somehow, somewhere?

Thank you very much!

2 Answers 2

0

Command line

grep -Eo "\b[abceilou]+\b" file.txt | sort -u

man grep for options
-E, --extended-regexp
-o, --only-matching
\b = word boundary

CyberChef

"The Cyber Swiss Army Knife - a web app for encryption, encoding, compression and data analysis". Playground (Don't hesitate to experiment with this or my recipes) : https://gchq.github.io/CyberChef/

It's open source (Apache-2.0 license) : https://github.com/gchq/CyberChef

It seems really complex but you only have to follow a few steps. Drag and drop Operations. To remove an Operation you can Drag Operations out.

enter image description here

Link to my recipe without the input (you can save with the input) :

Recipe 1

You can also extract list of words from a text (sort, remove duplicate, filter with regex). Copy in the input box or select a file. Link to this recipe :

Recipe 2

  1. Copy your input.
  1. Use your characters list :

    \b[abceilou]+\b

  2. The output format your want.

  • List matches
  • Highlight matches (better if you want to check your regex). The color alternate between blue and yellow.
  1. Output options.
  • Save output to file.
  • Copy raw input to the clipboard.
  • Replace input with output.
  1. Save/Load/Clear recipe
1
  • Thank you very much indeed! That's going to save me fifteen minutes of dull searching every week of the year! Commented Jan 16, 2023 at 15:47
1

Here is a regex that will only display words with specific letters from a list. To dispay a, m or i (upper and lower case):

[a-zA-Z]*[AaMmIi][a-zA-Z]*

You can use this webapp to filter your list with the regex above:

https://onlinelisttools.com/filter-list

How to set it up: screenshot how to set up regex

source: https://stackoverflow.com/questions/20924693/how-to-find-words-containing-a-certain-letter-with-regular-expressions

1
  • Thanks for your input! This shows words that include the character. However I want it to display all words that have no other characters except the specified ones. So if I look for s and e, I should get "see" but not "seat". Is there a way to modify this query? Commented Jan 13, 2023 at 21:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.