A hidden feature of TextEdit will allow you to search for patterns like email addresses, phone numbers and URLs. You can also construct complex search patterns. You can use these patterns to do complex text replacements such as switching around the order of items in your text.
Comments: 6 Responses to “TextEdit Pattern Search and Replace”
Eric
7 years ago
That's really useful. Clearly, it uses regular expressions behind the scenes but obviates the need to remember the regular expression syntax. Thanks Gary. I wasn't aware of this facility.
Douglas
7 years ago
I've used TextEdit for a lot of years without having realized it could do pattern match search and replace. So much friendlier than GREP. Thanks for the thorough tutorial.
Mick
7 years ago
Hands down the best tip I've read in eons! Thanks very much for this.
Stephen
7 years ago
Your best tip in ages, Gary - thank you so much. A really straightforward yet powerful new tool already on my Mac, just waiting to be revealed.
Jasper
7 years ago
Thank you - I knew about 'Insert Pattern' but not that it could used as in your US states example. I would've pasted the text into a spreadsheet and dragged columns around...
Am I missing something tho'? Is it possible to Save (rather than Replace) what you've asked 'Insert Pattern' to find...to create a new text file?I grep spam emails to get senders' addresses in BBEdit. Once I've got them I can 'extract' and save the text as a black list. Any ideas on doing this with TE?
Jasper: Nothing comes to mind as a way to do that in TextEdit. If you have it working in BBEdit, probably best to stick with that. BBEdit is very powerful.
That's really useful. Clearly, it uses regular expressions behind the scenes but obviates the need to remember the regular expression syntax. Thanks Gary. I wasn't aware of this facility.
I've used TextEdit for a lot of years without having realized it could do pattern match search and replace. So much friendlier than GREP. Thanks for the thorough tutorial.
Hands down the best tip I've read in eons! Thanks very much for this.
Your best tip in ages, Gary - thank you so much. A really straightforward yet powerful new tool already on my Mac, just waiting to be revealed.
Thank you - I knew about 'Insert Pattern' but not that it could used as in your US states example. I would've pasted the text into a spreadsheet and dragged columns around...
Am I missing something tho'? Is it possible to Save (rather than Replace) what you've asked 'Insert Pattern' to find...to create a new text file?I grep spam emails to get senders' addresses in BBEdit. Once I've got them I can 'extract' and save the text as a black list. Any ideas on doing this with TE?
Jasper: Nothing comes to mind as a way to do that in TextEdit. If you have it working in BBEdit, probably best to stick with that. BBEdit is very powerful.