10 Replies Latest reply on May 9, 2012 1:19 AM by ysun

    Regex in FileMaker

    ysun

      I'm trying to use Regex to extract ticket numbers from booking texts. To that end I've started testing and comparing:

      • 360Works Scribe
      • Jens Teich's RegEx Plugin
      • 2empowerFM Text Toolkit

       

      I'm not getting the wished for result with any of them.

       

      Yes, it's up to me to read and understand the documentation

      But since if's failing with any of them... (only errors and non-matches): I can't have misread all of the docs, can I?

      So, is there something special about a regex to be used within FM? The one I'm using is valid - in theory and according to both http://regexpal.com/ and http://gskinner.com/RegExr/

      ETKTs+([ds]+)s

       

      This is supposed to find the following string and extract just the numbers with $1:

      ETKT 724 2125 586 998

       

      Within the booking text of an eticket

       

      ETKT 724 2125 586 998 ACN KMXE5U

      ISSUED 24OCT11 13.37.46 LXZ30FD AGT 81493215 CH PNR KLLPM8

      SWISS COMMERCIAL / ZURICH<

      ----------------------------------------------------------------

      <...snip...>

       

      Any pointers? Maybe to another regex tool, or that you can confirm there's nothing wrong with the regex and I should read the documentation again, or whatever.

       

      TIVMA!

      Yuan-Yuan

        • 1. Re: Regex in FileMaker
          carole

          What does the regex you are using return to you?

          Oftentimes, what you do get will give you the clue as to what you need to change.

          Also, 360 works is based on java regex which is slightly different from other versions (such as perl) so be sure that you are testing a java version.

          1 of 1 people found this helpful
          • 2. Re: Regex in FileMaker
            ysun

            Thank you for your answer carole!

             

            My plugins return the following

            Regex Plugin:  ?

            Scribe: ERROR

            empower: 0

             

            And all I'm trying to match is the string "ETKT" (that's the current expression, no fancy wildcards)

            There really shouldn't be a problem with that, should there. Think it may be that I'm using the plugins wrong. Back to read the documentation then.

            • 3. Re: Regex in FileMaker
              HJ_Ybk_Admin

              I found that with Java Regex in ScriptMaster (360 works), you have to escape the escaped characters.

              Thus your Regex should look like: \\bETKT\\s+([\\d\\s]+)\\s

              Possibly this will work with Scribe?

              1 of 1 people found this helpful
              • 4. Re: Regex in FileMaker
                ysun

                Thank you very much. That is very important to know. Unfortunately it hasn't helped with my problem at hand.

                 

                I really think I may be doing something wrong with the plugins in general, but have for now given up on regexes. Not as a topic in general I wish to figure out. But for this particular task. The user will just have to scan the text and copy/paste that number into a separate field.

                • 5. Re: Regex in FileMaker
                  comment

                  I don't know about Regex, but I believe you could extract that number using Filemaker's native text functions.

                  • 6. Re: Regex in FileMaker
                    ysun

                    The eTicket number I think I could have gotten by finding the position of the word "etkt", and then maybe by getting a certain number of characters, or words next to it.

                    There was however more information to be extracted from that same booking text. I have not mentioned that before, I know. But if I'd gotten it to work I could have used the same knowledge for the rest of it, too.

                     

                    Thank you for the pointer, however.

                    • 7. Re: Regex in FileMaker
                      comment

                      ysun wrote:

                       

                      There was however more information to be extracted from that same booking text.

                       

                      I don't see why it too couldn't be extracted using Filemaker's native text functions. As long as there are rules that a mechanised process can follow.

                      • 8. Re: Regex in FileMaker
                        carole

                        If the pattern you are looking for starts at a newline, perhaps you need to use that in your regex, not just new word boundary. Just a thought. Hope you have persisted.

                         

                        You could also use native FM functions to find the position of your pattern and then work from there--it will be clunkier but once you've got it, then make a custom function and just call that.

                        • 9. Re: Regex in FileMaker
                          Mike Duncan

                          I haven't tried this myself, but am aware of an example from this site:

                           

                          http://www.spf-15.com/fmExamples/

                           

                          There is a link to a sample file with custom functions by Shawn Flisakowski... "Perl-Style Regular Expressions inside FM Pro 7"

                           

                          Lots of other very cool stuff on that page as well.

                           

                          Hope this helps

                          • 10. Re: Regex in FileMaker
                            ysun

                            Thanks to Carole and Mike. Had put this on ice for the moment. But thanks for your answers. Have all the necessary information. Just need to go do work on it now