Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #5627

    owilsky
    Participant

    I want the text between two commands/tags to be highlighted.

    I want to highlight everything between two *FONT commands excluding the commands.

    Example: *FONT 3text*FONT 0
    here only “text” should be highlighted. The numbers 3 and 0 could be any number.

    I tried this with lookbehind and lookahead:

    (?< =*FONT ?d+).*?(?=*FONT ?d+)Unfortunately lookbehind does not allow a regex but only text, so “(?< =*FONT ?d+)" does not work.Any ideas how this could be achived?Thanks!

    #5630

    Yutaka Emura
    Keymaster

    owilsky wrote:
    I want the text between two commands/tags to be highlighted.

    I want to highlight everything between two *FONT commands excluding the commands.

    Example: *FONT 3text*FONT 0
    here only “text” should be highlighted. The numbers 3 and 0 could be any number.

    I tried this with lookbehind and lookahead:

    (?<=*FONT ?d+).*?(?=*FONT ?d+)

    Unfortunately lookbehind does not allow a regex but only text, so “(?<=*FONT ?d+)" does not work.

    Any ideas how this could be achived?

    Thanks!

    Unfortunately, the regular expression engine does not support variable length of lookbehind and lookahead. You will need to have the expression fixed length in lookbehind and lookahead can be matched.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

Share with friends... Tweet about this on TwitterShare on FacebookShare on Google+Email this to someone