With regular expression I am trying to replace text within straight quotes into curly quotes. I use: '[^"]*'
or '[a-z]*'
to individually search single quoted text. But how do I maintain the text while replacing the straight quotes into curly ones? I used replace with ‘$1’
and ‘$&’
but without the desired result.
[Solved] How to replace straight quotes into curly quotes with regular expression
Martijn
#1
0 Likes
kingkeith
#2
you need to use capture groups if you want to use some of the captured text in a replace expression. Capture groups are those in parenthesis, and are numbered starting from 1 (capture group 0 is always the whole match).
try
Find: '([^']*)'
Replace: ‘$1’
2 Likes
kingkeith
#4
sorry, I messed up the placement of the closing paren and the star - I’ve now edited my post to correct it. Please can you try again.
0 Likes