Reverse Words
Reverse Words does not preserve original punctuation or spacing. It extracts sequences of Unicode letters/numbers plus apostrophes and hyphens, reverses that list, and joins with one space. Line breaks, commas, periods, emoji, symbols, and separators disappear; attached leading/trailing apostrophes or hyphens can be included by the permissive token pattern.
Runs locally — files stay on your deviceAre punctuation and original spaces preserved?
No.
Word extraction is a lossy tokenization
Reordering tokens after discarding separators cannot reconstruct the original sentence layout.
How it works
A Unicode regex extracts word-like sequences, Array.reverse changes token order, and a single space joins them.
Key concepts
Separators discarded
Commas and line breaks vanish.
Hyphens/apostrophes included
The regex treats them as part of tokens.
When to use it
- Reverse a plain list of word tokens.
- Create a normalized word-order exercise.
- Inspect extracted words in reverse.
When not to use it
- Do not expect punctuation preservation.
- Do not use for exact document transformations.
- Do not assume language-aware tokenization.
Worked examples
Simple
- Input
one two three- Expected output
three two one
Words reverse.
Punctuation
- Input
Hello, world!- Expected output
world Hello
Comma/exclamation disappear.
Lines
- Input
a\nb- Expected output
b a
Line structure disappears.
Common mistakes
Expecting punctuation movement
Punctuation is dropped. Correction: Use a tokenizer preserving separators.
Calling it language-aware
Regex rules are broad. Correction: Use locale segmentation.
Using on formatted text
Formatting is destroyed. Correction: Keep structured source.
Best practices
- Use only when lossy normalization is acceptable.
- Preview punctuation loss.
- Keep source text.
Related operations and differences
Add Prefix to Every Line
Choose Add Prefix to Every Line when you need to add the same prefix before every line.; use Reverse Words specifically for reverse words.
Add Suffix to Every Line
Choose Add Suffix to Every Line when you need to add the same suffix after every line.; use Reverse Words specifically for reverse words.
Capitalize Every Word
Choose Capitalize Every Word when you need to capitalize the first character of every word.; use Reverse Words specifically for reverse words.
Extract Email Addresses
Choose Extract Email Addresses when you need to find unique email addresses in text.; use Reverse Words specifically for reverse words.
Extract URLs
Choose Extract URLs when you need to find unique HTTP and HTTPS links in text.; use Reverse Words specifically for reverse words.
Line Counter
Choose Line Counter when you need to count the number of text lines.; use Reverse Words specifically for reverse words.
Limitations and privacy
- Regex word extraction and single-space join only; no punctuation, whitespace, emoji, line, formatting, grapheme, or language-specific preservation.
Text is transformed locally in this browser and is not uploaded by the tool.
Frequently asked questions
Are commas retained?
No.
Are line breaks retained?
No.
Are hyphenated forms one token?
The regex can include hyphens.
Is original text recoverable?
No.