[texworks] Regex challenges
Jonathan Kew
jfkthame at googlemail.com
Fri Apr 10 15:45:00 CEST 2009
On 10 Apr 2009, at 14:01, Joseph Wright wrote:
> Hello all,
>
> I'm trying to improve my set of regex expressions for writing DTX
> files.
> There are a couple I'm stuck on: suggestions welcome.
>
> 1) The standard pattern for matching control sequences is
> \\(?:[A-Za-z@]+|.) This behaves OK unless I follow the sequence by a '
> character. If I do, anything following the last @ is not coloured but
> stays black. If I extend the match sequence for LaTeX3-like code
> \\(?:[A-Za-z at _:]+|.) then anything after the last non-letter (@, :, _)
> is not coloured. Is my expression defective or is this the matching
> system?
I'm not seeing the behavior you describe, as far as I understand it;
e.g.,
\this at is@a at test'with quotes following'
colours everything up to "test" (but not including "'with") as the
control sequence.
What version and platform are you on?
>
> 2) In a DTX, comments in the explanation part start ^^A. This is
> easy to
> match with \^\^A, but that matches even in the code blocks. Ideally,
> I'd like:
> - If the line start %, comment = ^^A
> - If the line starts without %, comment = %
> but only colouring from the start of the comment, not the start of the
> line. Is this doable at all?
I can't think of a way to do this.
JK
More information about the texworks
mailing list