Page 1 of 2

Scintilla line highlighting

Posted: Tue Jul 02, 2024 3:35 pm
by rndrei
Please tell Scintilla how to highlight a line with a comment, I found information about highlighting numbers:

Code: Select all

reg() = "\d+"
How can I highlight a line with the "#" symbol?
I couldn't find any information on the Scintilla website...

Re: Scintilla line highlighting

Posted: Tue Jul 02, 2024 4:01 pm
by AZJIO

Re: Scintilla line highlighting

Posted: Tue Jul 02, 2024 8:16 pm
by boddhi
rndrei wrote: Please tell Scintilla how to highlight a line with a comment, I found information about highlighting numbers:

Code: Select all

reg() = "\d+"
How can I highlight a line with the "#" symbol?
Assuming your request is for RegEx, a comment example would have been helpful to refine it!
So, exclusively for lines beginning with # :

Code: Select all

reg() = "^#.*"

Re: Scintilla line highlighting

Posted: Tue Jul 02, 2024 9:01 pm
by rndrei
Yes, thanks, that's what I need

Re: Scintilla line highlighting

Posted: Thu Jul 18, 2024 2:02 pm
by rndrei
where can I get a complete list of regex codes?

Re: Scintilla line highlighting

Posted: Thu Jul 18, 2024 2:38 pm
by AZJIO
Google?
https://scite-ru.bitbucket.io/pack/doc/SciTERegEx.html - it's not objective, it's SciTE, not Scintilla

https://azjio.narod.ru/regexp/RegExpEn.htm - This is a PCRE engine, and Scintilla has a very stripped-down engine.

Instead of \b, use "\<" and "\>" (word boundaries). Instead of the range [a-zA-Z]+ you need to use [qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM]+
No forward and backward preview (?<=...) and (?=...)
No OR sign "|" to highlight a set of keywords, you need to specify each one separately

Re: Scintilla line highlighting

Posted: Tue Jul 23, 2024 12:22 pm
by rndrei
thank you, otherwise I couldn’t find the information :)

Re: Scintilla line highlighting

Posted: Mon Sep 30, 2024 7:51 am
by rndrei
I can't figure it out! If two words are needed, then what kind of construction will it be?

Code: Select all

reg()="(text_first|text_second)"

Re: Scintilla line highlighting

Posted: Mon Sep 30, 2024 8:03 am
by Demivec
rndrei wrote: Mon Sep 30, 2024 7:51 am I can't figure it out! If two words are needed, then what kind of construction will it be?

Code: Select all

reg()="(text_first|text_second)"
Do two separate searches.

Re: Scintilla line highlighting

Posted: Mon Sep 30, 2024 8:08 am
by rndrei
I need one search

Re: Scintilla line highlighting

Posted: Mon Sep 30, 2024 12:38 pm
by spikey
The solution you presented should work, if you're searching for specific words. What sort of problem were you having? Or what string that you expected to match, didn't?

Can I recommend you bookmark https://regex101.com/. It's a reference site for various flavours of regex, testing sandpit and will even explain and try to debug your regexes too, all in a webpage, for free and you don't even need to sign up... Oh and there's a searchable list of other people's solutions to various problems too.

Re: Scintilla line highlighting

Posted: Mon Sep 30, 2024 4:44 pm
by Demivec
@Spikey: Scintilla's base implementation of regular expressions is simple and limited. For example it doesn't implement the 'I' for matching OR expressions. AZJIO mentioned a few other limitations in his earlier post as well.

https://www.scintilla.org/ScintillaDoc.html#Searching

Re: Scintilla line highlighting

Posted: Thu Mar 27, 2025 4:56 pm
by rndrei
I can't figure out how to make an exception?
For example, all words except those ending with the symbol ";"
The example does not work:

Code: Select all

regex()\re = "[a-zA-Z](^;)"

Re: Scintilla line highlighting

Posted: Thu Mar 27, 2025 7:13 pm
by rndrei
Got it! If anyone is interested, it will be like this:

Code: Select all

 regex()\re = "[a-zA-Z]+[;]"

Re: Scintilla line highlighting

Posted: Fri Mar 28, 2025 2:06 am
by AZJIO

Code: Select all

[a-zA-Z]++(?!;)