Hi Joaquin,
My guess is that keywords are whitespace separated character runs – they
don't contain whitespace.
BBEdit probably chunks the keywords "before" matching against the regular
expression chunk by chunk.
For example what your regular expression matches against is the string
"label2:", not the whole line. Thus the start of line anchor always applies.
The Numeric Tags appear correctly because they are excluded from the
"Number Pattern" not because of the start of line anchor.
I fear that keyword patterns won't let you do what you want. You will have
to use the other patterns that are whitespace aware… but there is a limited
number of those.
HTH,
Jean Jourdain
On Monday, January 15, 2024 at 5:42:48 PM UTC+1 Joaquin Adiego wrote:
> Hi Maarten,
>
> Thank you for your kind reply. I have already tested the expression you
> suggest (I haven't tried that variant yet) and the result is the same. The
> fact is that it is a bit strange that it works for one subexpression and
> not for another very similar one.
>
> Regards.
>
> El domingo, 14 de enero de 2024 a las 20:09:34 UTC+1, Maarten Sneep
> escribió:
>
>> Hi,
>>
>> I think you need to anchor the whole expression:
>>
>> (?x:
>> ^(([a-zA-Z_]{1}[a-zA-Z0-9_]*:)|
>> ([1-9]{1}[0-9]*))
>> )
>>
>> (I have not tested this yet).
>>
>> Maarten
>>
>> On 14 Jan 2024, at 11:32, Joaquin Adiego <[email protected]> wrote:
>>
>> Hi,
>>
>> I'm developing a codeless language module for Boriel ZX Basic. Everything
>> works fine except the labels (which can be the old Basic line numbers, at
>> the beginning of the line, or an identifier ending with ':' also at the
>> beginning of a line). I have used regular expressions to recognize all
>> language elements (see file attached). Numeric tags are recognized well
>> (appearing in green, see the screenshot attached), but text tags are not,
>> recognizing strings that are not at the beginning of a line as tags as
>> well. The two regular expressions are similar, so I don't understand very
>> well why it works well in one case and doesn't work in the other. I have
>> tried rewriting the regular expression in different ways but have not been
>> successful, so I deduce that the problem must lie in the module
>> specification, but I am not able to locate it.
>>
>> Can anyone help me with this?
>>
>> Regards
>>
>>
>>
>> --
>> This is the BBEdit Talk public discussion group. If you have a feature
>> request or need technical support, please email "[email protected]"
>> rather than posting here. Follow @bbedit on Twitter: <
>> https://twitter.com/bbedit>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "BBEdit Talk" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/bbedit/cf17d86a-e9dc-4851-bfb3-e82ae386008an%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/bbedit/cf17d86a-e9dc-4851-bfb3-e82ae386008an%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> <Captura de pantalla 2024-01-14 a las 11.17.03.png><BorielBasic.plist>
>>
>>
>>
--
This is the BBEdit Talk public discussion group. If you have a feature request
or need technical support, please email "[email protected]" rather than
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/bbedit/83a187f5-3f7c-4c0f-9016-5534337026e8n%40googlegroups.com.