I have some text here:
... che si concluse con la " desegregazione " degli autobus.
What regular expression can I use to grab these spaces and turn this into:
... che si concluse con la "desegregazione" degli autobus.
I was thinking of something like (?<=\".{1,20})\"
(sorry if it's clunky, I'm a beginner), but apparently Regex doesn't accept quantifiers inside of lookbehinds, so I'm at a loss.
You may use
"\s*([^"]*?)\s*"
Replace with "$1"
.
See the regex demo
Details
"
- a double quotation mark\s*
- 0+ whitespaces([^"]*?)
- Group 1 ($1
in the replacement pattern refers to this value): any 0+ chars other than "
(see [^"]
negated character class), as few as possible (see *?
non-greedy quantifier)\s*
- 0+ whitespaces"
- a double quotation mark.