I'm using TeXworks (Version 0.4.5) and came in touch with its regular expression (regex) feature, recently. I made some adjustments of the syntax-highlighting, for instance, to practice.
Now I'm asking: Is it possible that TeXworks doesn't support the lookbehind (?<= )
expression? At least in the Find&Replace dialogue? Because my regex-input gets marked "invalid" as soon as I try to use it there. Also, the TeXworks-manual doesn't list the lookbehind-, but it does list the lookahead-expression.
The actual problem I want to solve:
I want to replace \verb+BLABLA+
by \emph{BLABLA}
.
I tried to search for \+(?<=verb\+.*)
and replace the match (which should be the closing +
) by }
. Then I'd search for verb\+
and replace that by emph{
.
I stumbled over the fact, that most regex-flavors don't support the .*
or '.+' in a loobehind, though, which still leaves the question above unanswered.
Secondly, how would you solve the actual problem if not via lookbehind?
\\verb\+([^\+]*)\+
for find and\\emph\{\1\}
for replace. Obviously that might not be quite right for TeX Works. Forsed
I would use something likes/\\verb\+\([^\+]*\)\+/\\emph{\1}/g'
. – cfr Apr 12 '14 at 21:54\1
-method" uses back references, right? – LCsa Apr 13 '14 at 9:42^
) matched, right? @JosephWright I appearently don't know what regular expressions (and non-regular ones) exactly are... – LCsa Apr 13 '14 at 9:49