Regular Expressions in wordfile.txt

Regular Expressions in wordfile.txt

4
NewbieNewbie
4

    Sep 14, 2004#1

    Is it possible to use RegEx in wordfiles? I would like to highlight my local variables that always start with "X." or "XL.". I've tried different combinations of RegEx and haven't had any luck. Anybody have any suggestions?

    Thanks,
    mcgiddin

    6,606548
    Grand MasterGrand Master
    6,606548

      Sep 14, 2004#2

      Copied from the syntax highlighting help of UE:
      --------
      Keywords beginning with a substring

      There are instances in some languages where it is desirable to highlight keywords that begin with a particular sub-string, however the complete word is not known. UltraEdit provides the ability to define sub-strings that are used to determine if a word should be highlighted. If such sub-strings are defined for a particular language under a color group UltraEdit will determine if a word begins with one of the sub-strings. If it does, it will be highlighted accordingly.

      The sub-strings should be defined as with any other set of keywords however the line containing the sub-strings should start with "** " and all sub-strings should be on the same line as in:

      ** aaa bbb

      The example above would highlight any words beginning with "aaa" or "bbb".
      --------

      So for your need simply add following line to your wordfile:

      ** X. XL.

      Check also, that '.' is not a delimiter character or it would not work.
      Best regards from an UC/UE/UES for Windows user from Austria

      4
      NewbieNewbie
      4

        Sep 14, 2004#3

        Thanks.. (works like a champ)

        13
        Basic UserBasic User
        13

          Sep 28, 2004#4

          using Regexp's in the wordfile would still be nice (or maybe they exist and I just dont find them in the manual). E.g. colour values:

          #[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]

          tried that but doesnt work :cry:

          ** # would highlight the colour value but would not check for a valid value (#00gg00 == hyper bright green? :roll: ) ...

          ... greetings (also) from Austria
          FoTo50

          6,606548
          Grand MasterGrand Master
          6,606548

            Sep 28, 2004#5

            Hi foto50,

            I write the answer in English, so every user can read it, but nice to see an other Austrian here.

            Yes, correct syntax checking for numbers (in assembler?) is not possible. As a workaround, you could list all possible numbers as words.

            For example: #0000 #0001 #0002 #0003 .... #0FFFF

            But this would create a really big list of words, depending on the bit width.

            Regular expressions for general words in the color definitions would be to difficult to implement and would decrease the speed of UltraEdit dramatically.

            But what could be useful is, that 1 regular expression can be defined for numbers for each language. So UltraEdit does not simply highlight the whole word starting with a digit as number. UE should do it only, if the whole word starting with a digit found is also a valid result of the regular expression.

            Example for not case sensitive ASM:
            /Number Strings = ^{[0-9A-F]+H^}^{[0-9]+^}

            Found - 45 ... regexp result - 45 -> valid number
            Found - 45h ... regexp result - 45h -> valid number
            Found - 45Fh ... regexp result - 45Fh -> valid number
            Found - 45F ... regexp result - 45 -> not a valid number
            Best regards from an UC/UE/UES for Windows user from Austria

            13
            Basic UserBasic User
            13

              Sep 28, 2004#6

              hehehe ... just a short calculation: 16,777,215 possible colours * (6 digits + 1 char '#' + 1 space) = ... is there any max filesize for a wordfile? :lol:

              /Number Strings might be a solution most of time but not exactly what I was looking for since I use a quite self changed version of HTML+PHP+MySQL (besides lot of others) and NEED the "ordinary" number highlighting ... or better saying .. I'm used to it sooo much already .. :wink:

              Anyway ... thinking that most of time I use websafe colours anyway might reduce the above calculation by far if I add them as words:
              #000000 #000033 .... #ffffcc #ffffff = 216 possible colours

              Thanks for your help and "servus"
              FoTo50
              [email protected]

              1
              NewbieNewbie
              1

                Oct 29, 2004#7

                I understand that using regular expressions could slow down the speed of ultraedit dramatically, but still for me it would be on top of the list of wanted new features. I've been looking all over the web for programs with this functionality and found only one program which could do it (EditPad Pro). Only this program has many other limitations (i.e. I need the functionality of seeing search result in the list box, ability to open (very quickly) huge files, like UltraEdit does).

                With a good RegEx engine, it shouldn't be a huge problem to implement Syntax Highlighting based on regular expressions. I could imagine you don't have to process the whole file at the same time, but only a buffer of what is visible on the screen (and maybe some lines above and below that).

                Of course one disadvantage of using RegEx in syntax highlighting is that if somebody creates the expressions wrong (i.e. wrong usage of .* ) , it could end up in the programming (seeming to) hanging, or at the least becoming very, very slow.

                I would very much appreciate the possibility of using regex in syntax highlighting (maybe a possibility to turn it on or off, so that one can choose). As well as the possibility to highlight a complete line.