I'm using BBEdit or Visual Code and I'm not too experienced with regex but would like to do a simple find and replace to all instances of "teaspoon(s)" (as in teaspoon or teaspoons) and "tablespoon(s)" with "tsp" and "tbsp".
replace:
1 tablespoon sugar
2 teaspoons salt
2 tablespoons butter
3 teaspoons crystal meth
with:
1 tbsp sugar
2 tsp salt
2 tbsp butter
3 tsp crystal meth
The replace search term should encompass all four variants in one go. Any help would be much appreciated.
You can capture the "b" from "table" to do it in one replacement:
search:
\bt(?:a(b)le|ea)spoons?\b
replace:
t$1sp
$1
is a placeholder for the captured content (theb
if any).