I am trying to figure out how I can put together a find and replace command with wildcards or figure out a way to find and replace the following example:
I would like to find terms that contain double quotes in front of them with a single quote at the end:
Example: find "joe' and replace with 'joe'
Basically, I'm trying to find all terms with terms having "in front and at the end.'
Check the
[x] Regular expression
checkbox in textpad's replace dialog and enter the following values:Find what:
Replace with:
Explanation:
In a regular expression, square brackets are used to indicate character classes. A character class beginning with a caret will match anything not in the class.
Thus
[^'"]
will match any character except'
and"
. The following*
indicates that any number of these characters can follow. The(
and)
mark a group. And the group we're looking for starts with"
and ends with'
. Finally in the replace string we can refer to any group via\n
where n is the nth group. In our case it is the first and only group and that is why we used\1
.