4 Replies Latest reply on Nov 21, 2013 12:36 PM by ChrisRosa

    substitute and wildcards?

    ChrisRosa

      Title

      substitute and wildcards?

      Post

           I'm using Filemaker to make some logfiles from Windows Server 2003 a bit more readable. Specifically I'm trying to extract and cleanup the DNS name on a log line. Here's a sample of how it looks in the log...

      (10)fpdownload(10)macromedia(3)com(7)edgekey(3)net(0)

           What I'm trying to do, is substitute the parenthesis and numbers with just a period, to make the domain name more readable. I'm finding that "(*)" doesn't work, as I'm sure the quotes are escaping the wildcard. And it seems "("&*&")" isn't even allowed with a substitute function. I could easily remove the parenthesis alone, but that would leave the numbers.

           Thanks for any tips.

        • 1. Re: substitute and wildcards?
          philmodjunk

               Wild cards cannot be used with substitute.

               Let ( T = Filter ( YourDNSFieldHere ; "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz()" ) ; // removes digits
                       Substitute ( T ; ["(" ; "." ] ; [")" ; "" ] )
                     )

               But I am also making the assumption that no text appears outside of the parenthesis that needs to be kept as part of the resulting text.

               To handle all possible variations to what you see here might require either a looping script or a recursive custom function (requires FileMaker Advanced).

          • 2. Re: substitute and wildcards?
            ChrisRosa

                 That actually works fairly well, but pulls numbers outside of the parenthesis that are legitimate parts of the domain name, like these...

            dr(7)_dns-sd(4)_udp(1)0(2)55(3)211(2)10(7)in-addr(4)arpa
            
            s0(4)2mdn(3)net

                 Looks like I may have to preprocess the file before bringing it into FM.

                 Thanks

            • 3. Re: substitute and wildcards?
              philmodjunk

                   Which is why I said: "But I am also making the assumption that no text appears outside of the parenthesis that needs to be kept as part of the resulting text."

                   You don't have to preprocess the data but that is an option.

                   Another option that might work is this:

                   Substitute ( YourTextFieldHere ; [(1) ; "." ] ; [(2) ; "." ] ; [(3) ; "." ] ; [(4) ; "." ] ; [(5) ; "." ] ; and so forth... [(10) ; "." ] )

                   But note that this also has a limitation in that values greater than (10) will not be processed.

                   And don't forget that you also have options where a script or recursive function makes the substitution.

              • 4. Re: substitute and wildcards?
                ChrisRosa

                     Finally figured out the regex, so I think I'll just pre-process and call it done.

                (\(\d+\))

                     Thanks again for the help.