3 Replies Latest reply: Jul 29, 2013 10:45 AM by George AV RSS

    AutoVue 20.2.1 - ABV - Regular Expressions

    NickBannister
      All,

      We have implemented the ABV/HotSpots feature and there is a regular expression we have defined that should work but isn't.

      Regular Expression:
      ^[0-9]{5}$

      Text:
      00345

      Using http://www.regular-expressions.info/javascriptexample.html to test it works seems is fine. So a00345, 00345a, 0a0345, test 00345 ALL fail which is what i want.
      But when i setup the hotspot definition with the above it doesn't match the cases in the PDF document.
      If i remove the ^ and $ then it does match but it matches cases i do not want (example: DVA-AB-12345)
      I want 5 number and that is it, nothing before or after.
      I am confused as to why the regular expression tester is saying it is fine and then AutoVue HotSpots fails it.
      I have thought about case sensitive and and either way true or false we are using numbers so it shouldn't affect things.

      Can anyone help?

      Nick
        • 1. Re: AutoVue 20.2.1 - ABV - Regular Expressions
          George AV
          We are concatenating the strings together because we have many formats (mainly PDF) that may split words into separate string.
          We are also inserting '\n' and ' ' depending on the relative location of the following string.

          I recommend trying allowing for spacing around: (^|\s)[0-9]{4}(\s|$)

          Thanks

          George
          • 2. Re: AutoVue 20.2.1 - ABV - Regular Expressions
            NickBannister
            Hi George,

            Your suggestion sort of works. It now highlights the text including the space before and after.
            I was hoping to highlight the text only because we perform certain behaviour on this value which we can trim it just seems a shame that this would be required.
            I am able to search for the text using Auotvue via Ctrl+F and it goes straight to the text.
            I am also confused why we need to add the check for the spaces in because ' 12345 ' as string should be fine and only 12345 highlight right?

            Nick
            • 3. Re: AutoVue 20.2.1 - ABV - Regular Expressions
              George AV

              Hi Nick,

               

               

              Currently, there is no way for you to specify which characters to highlight within the regular expression.

               

               

              Theoretically, it could be done through regex groups: (^|\s)(\d{4})(\s|$), highlight group # 2.

              We would need to enhance our API to accept the group index to highlight.

               

               

              Please log an enhancement request for this feature. I'm sure it will be very useful!

               

              Thanks,

               

               

              George