How to Use the Letters Extractor
- Paste or type your text into Your Text. The result on the right changes as you type.
- Under Extract By, keep Character Type to filter the text by kind of character, or pick Position to get letters from set places in words and lines.
- With Character Type, pick What to Extract: letters, digits, letters and digits, capital letters, small letters, or whole numbers with their decimal points and minus signs.
- With Position, pick Which Letters: the first or last letter of each word, the first letter of each line, or every Nth letter. For every Nth letter, type N and, if you want, the letter to start at.
- Pick an option under Spaces and Line Breaks. By default, with Character Type the words are kept apart; with Position the letters from one line are joined.
- Select More Options to remove accents, keep only A to Z, change the case, sort the result or keep each character once. Select Copy Result to copy the result exactly as shown.
Example With Letters From an Order Note
The example text is a three line order note with an order code, a date, a name with accents, a street number and a price in euros:
Order #A-4471, shipped 12/03 (rush!)
Ship to: Zoë Müller, 9 Rue Café
Ref: XK-209 / total €58.40With Letters only and Keep spaces and line breaks, the result is 49 letters on three lines:
Order A shipped rush
Ship to Zoë Müller Rue Café
Ref XK totalThe line under the result is 95 characters in, 49 kept, 46 dropped: 16 digits, 14 spaces, 2 line breaks and 14 other characters.
The ë, ü and é are kept, because accented letters are letters. The A from the order code A-4471 is kept as a word of its own, and the digits and symbols are dropped. To get only the code letters of XK-209, pick Capital letters only: the last line of that result is R XK.
Letters, Digits and Numbers From One Text
The table has the result for the order note with each choice in What to Extract and with Keep spaces and line breaks.
| What to Extract | Result | Found |
|---|---|---|
| Letters only | Order A shipped rush | 49 |
| Digits only | 4471 1203 | 16 |
| Letters and digits | Order A4471 shipped 1203 rush | 65 |
| Capital letters only | O A | 10 |
| Small letters only | rder shipped rush | 39 |
| Numbers | 4471 12 03 | 6 |
With Digits only, every digit is kept on its own, so the date 12/03 becomes 1203: the slash between the two parts is dropped. With Numbers, each number is kept whole and apart, so the same date becomes 12 03 and the decimal point in the price 58.40 is kept. In Capital letters only, there is a space between O and A because a space was dropped between them, while X and K are joined because they were next to each other.
Digits Versus Numbers
Pick Digits only when you want the digits of a phone number, a postcode or an account number as one string. Pick Numbers when you want the values: amounts, measurements or counts, each one apart. For the text Paid $1,299.50 on 12/03, then -3 dB and (−7) at 4.5%, the two results are:
| Choice | Result |
|---|---|
| Numbers | 1,299.50 12 03 -3 -7 4.5 |
| Digits only, One space between groups | 1 299 50 12 03 3 7 4 5 |
A number is a string of the digits 0 to 9. A point or comma with a digit on each side is part of the number, so 1,299.50 is kept whole, while a comma with a space after it is the end of the number. A hyphen or a minus sign just before the first digit is kept as a minus sign when there is a space, a line break or an opening bracket before it, so -3 and (-7) become -3 and -7, but the hyphen in a code such as A-4471 is dropped. With Order set to A to Z, numbers are sorted by value, smallest first, with commas read as thousands separators: the numbers in the order note are 03 9 12 58.40 209 4471.
Spaces and Line Breaks in the Result
The table has the order note digits with each choice. Characters that were next to each other in your text are always kept together; the choice is for what is put between characters that had something dropped between them.
| Choice | Digits of the Order Note | When to Use It |
|---|---|---|
| Keep spaces and line breaks | 4471 1203 | Words are kept apart and each line is kept as a line; characters with only symbols between them are joined |
| Keep line breaks only | 44711203 | One group of characters per line, such as the letters of a code on each row |
| One space between groups | 4471 12 03 9 209 58 40 | Every place where something was dropped becomes one space, all on one line |
| One group per line | 4471 | A column to paste into a spreadsheet |
| Join everything | 4471120392095840 | One unbroken string, such as a code with its dashes and spaces removed |
With Keep spaces and line breaks, several spaces in a row become one space, and no space is left at the start or end of a line. Blank lines are kept, and a line with nothing to extract is an empty line in the result, except at the very start and end. With Numbers picked, two numbers are never joined: where there would be nothing between them, there is one space.
Extract Letters by Position
Pick Position for initials, acronyms and acrostics, and for hidden messages in puzzles made from every second or third letter. A word is a group of letters and digits in a row. An apostrophe between two letters is part of the word, so don’t is one word, and the letters after a hyphen are a new word.
| Text | Which Letters | Result |
|---|---|---|
North Atlantic Treaty Organization | First letter of each word | NATO |
Don't count your chickens before they hatch | First letter of each word, Change Case: Capitals | DCYCBTH |
Don't count your chickens before they hatch | Last letter of each word | ttrseyh |
Every morning starts slowly, | First letter of each line, Join everything, Capitals | EMILY |
xHmEeLlLpO | Every Nth letter, N at 2 | HELLO |
The cat sat on a mat | Every Nth letter, N at 3, start at 1 | Tcsom |
The acrostic in the fourth row is a five line verse that starts with Every morning starts slowly,
with EMILY spelt down the left side. By default, with Keep line breaks only, the first letters are on five lines; pick Join everything to read them across. For every Nth letter, only letters are counted, not spaces, digits or punctuation, and N can be any number from 1 to 1,000.
Which Characters Count as Letters and Digits
Letters are the characters in the Unicode letter categories: capital letters, small letters, title case letters such as Dž, modifier letters, and letters with no case, such as Chinese characters and Arabic letters. With Capital letters only, the capital and title case letters are kept, and with Small letters only, the small letters, so a letter with no case is in neither. Digits are the Unicode decimal digits: 0 to 9 and the digits of other scripts, such as the Arabic-Indic ٣. With Numbers and with A to Z and 0 to 9 only, the digits are 0 to 9 alone. Superscripts such as ², Roman numerals such as Ⅻ, emoji and symbols are other characters and are always dropped.
| Text | Choice | Result |
|---|---|---|
Ωμέγα 3, Привет 5, 東京 7, ٣ | Letters only | Ωμέγα Привет 東京 |
Ωμέγα 3, Привет 5, 東京 7, ٣ | Digits only | 3 5 7 ٣ |
Ωμέγα 3, Привет 5, 東京 7, ٣, Zoë | Letters and digits, A to Z and 0 to 9 only | 3 5 7 Zoe |
Straße Øre łódź | Letters only, Remove accents | Straße Øre łodz |
An accent typed as a separate combining mark after its letter is kept with the letter and counted as one character, so Zoe with a combining diaeresis and Zoë typed as one character both are kept as Zoë. With Remove accents, the marks are removed and the base letter is kept; letters with no separate base letter, such as ß, ø and ł, are kept as they are. With A to Z and 0 to 9 only, the accents are removed too, and every letter and digit outside A to Z and 0 to 9 is dropped.
Unique Letters and Sorting
With Keep each character once on, the first copy of each letter is kept and later copies are left out, with capitals and small letters counted as the same letter. With Join everything and Small letters, the result for the order note is ordeashiputzëmülcféxk, 21 different letters, and the line under the result has 28 repeats left out. Set Order to A to Z as well and the same letters are sorted: acdeéëfhiklmoprstuüxz. In A to Z order an accented letter is after its base letter, so e, é and ë are next to each other.
Extract Letters in Excel, Google Sheets or Code
In Excel for Microsoft 365, the result of =REGEXREPLACE(A2,"[^A-Za-z]","") is the text in A2 with everything but A to Z removed, and with =REGEXREPLACE(A2,"[^0-9]","") only the digits are kept. Google Sheets has a REGEXREPLACE function with the same three arguments. Unicode character classes such as \p{L} are not supported in Sheets patterns, so use the A to Z pattern there, and accented letters such as é are dropped with it. For the first line of the order note, the results of the two formulas are OrderAshippedrush and 44711203.
In Python, ''.join(c for c in text if c.isalpha()) is every Unicode letter in the text, and with isdecimal() in place of isalpha(), the decimal digits. The JavaScript version of the first is text.replace(/\P{L}/gu, ''), with \P{Nd} for digits. All of these results are joined; to keep words apart, paste the text into Your Text and pick Keep spaces and line breaks.
How Characters Are Extracted and Counted
The text is read one character at a time. A character is one Unicode code point plus any combining marks after it, and a carriage return followed by a line feed counts as one line break. Each character is a letter, a digit, a space, a line break or another character. The characters kept are the ones that match the choice in What to Extract, or the position rule; with A to Z and 0 to 9 only, a letter or digit counts only if it is A to Z or 0 to 9 once its accents are removed.
Then, if you asked, accents are removed from the kept characters and the case is changed. With Keep each character once on, a character whose small letter form has been kept before is left out. The result is the kept characters in their order in the text, with a space or line breaks between them as set in Spaces and Line Breaks. With Order set to A to Z or Z to A, the kept characters are sorted with accents and capitals ignored, then put on one line, spaced or one per line if you picked those choices, and joined otherwise.
The counts under the result are for characters in your text: how many there are, how many were kept, and how many of each kind were dropped. Spaces and line breaks put into the result are not counted as kept. The text is read in your browser, so nothing you paste is sent anywhere, and the result for a text of 100,000 characters is ready in a fraction of a second.
FAQs
Q1. How Do I Extract Only the Letters From a Text?
To extract only the letters, paste the text into Your Text with Character Type and Letters only picked. Digits, punctuation and symbols are dropped and the words stay apart, so Order #A-4471, shipped 12/03 (rush!) becomes Order A shipped rush. Pick Join everything under Spaces and Line Breaks for one unbroken string.
Q2. How Do I Extract Numbers From Text?
To extract numbers from text, pick Numbers in What to Extract: each number is kept whole, with its decimal point, thousands commas and a leading minus sign, so Paid $1,299.50 on 12/03, then -3 dB and (−7) at 4.5% becomes 1,299.50 12 03 -3 -7 4.5. Pick Digits only for the digit characters alone, as for a phone number or a code you want as one string, and One group per line for a column of numbers.
Q3. How Do I Get the First Letter of Each Word?
For the first letter of each word, pick Position and First letter of each word, and the letters from each line are joined into one word: North Atlantic Treaty Organization becomes NATO. Set Change Case to Capitals under More Options for initials in capitals, the usual form of an acronym.
Q4. Are Accented Letters and Other Alphabets Kept?
Yes, accented letters such as é and ü and the letters of other alphabets, such as Greek, Cyrillic and Chinese, are kept as letters with the default choices. Under More Options, Remove accents changes é to e, and A to Z and 0 to 9 only keeps nothing but the basic Latin letters and the digits 0 to 9.
Q5. How Do I Find Every Second or Third Letter of a Text?
To find every second or third letter, pick Position and Every Nth letter, then type 2 or 3 in N. Only letters are counted, so spaces and punctuation do not change the count, and the result for xHmEeLlLpO with N at 2 is HELLO. Type a number in Start at Letter to begin somewhere other than the Nth letter.
Q6. How Do I List the Unique Letters in a Word or Text?
To list the unique letters, turn on Keep each character once under More Options, so only the first copy of each letter is kept, with capitals and small letters counted as one letter. Set Order to A to Z to sort them, and the 21 different letters of the order note are acdeéëfhiklmoprstuüxz.
Sources
Unicode Standard Annex #44, Unicode Character Database, for the general categories of letters (Lu, Ll, Lt, Lm, Lo), decimal digits (Nd) and combining marks (M). Python documentation, Built-in Types, for str.isalpha and str.isdecimal. MDN Web Docs, Unicode character class escape, for \p{L} in JavaScript. Microsoft Support, REGEXREPLACE function, for the Excel syntax and versions. Google Docs Editors Help, REGEXREPLACE, for the Google Sheets syntax and its lack of Unicode character classes.