2

I am writing a a syntax highlighting rule for jEdit. I have the string rule like this.

<SPAN TYPE="LITERAL1" NO_LINE_BREAK="TRUE">
    <BEGIN>"</BEGIN>
    <END>"</END>
</SPAN>

It works fine. The " char both starts and ends strings. However, I also want the + char to end strings, but not start them. However, this does not work.

<SPAN TYPE="LITERAL1" NO_LINE_BREAK="TRUE">
    <BEGIN>"</BEGIN>
    <END>("|+)</END>
</SPAN>

I also tried this, but to no avail.

<SPAN TYPE="LITERAL1" NO_LINE_BREAK="TRUE">
    <BEGIN>"</BEGIN>
    <END>"</END>
</SPAN>
<SPAN TYPE="LITERAL1" NO_LINE_BREAK="TRUE">
    <BEGIN>"</BEGIN>
    <END>+</END>
</SPAN>

I am out of ideas. What am I doing wrong?

1 Answer 1

0

I think you have to use SPAN_REGEXP tag instead of SPAN:

<SPAN_REGEXP TYPE="LITERAL1" NO_LINE_BREAK="TRUE">
    <BEGIN>"</BEGIN>
    <END REGEXP="TRUE">("|\+)</END>
</SPAN_REGEXP>

Don't forget to escape the +

2
  • I think this is on the right track, but it has some issues. The tag is SPAN_REGEXP. Also, the <END> tag needs REGEXP="TRUE" inside it, like this: <END REGEXP="TRUE">("|\+)</END> Aug 29, 2018 at 16:00
  • @Feldspar15523: You're right, fixed.
    – Toto
    Aug 29, 2018 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.