2 Replies Latest reply on Apr 17, 2007 6:32 AM by KCPLCF

    Regular Expressions

      Im trying to find all .cfm templates on our server that reference any of the following column names in the SQL where clauses. But having trouble pulling back just the SQL select statements.

      Column Names to find:

      Last attempted expression:
      where emp\w[lid_no ]|and emp\w[lid_no]

      Any help will be appreciated, thanks ahead of time.

        • 1. Re: Regular Expressions
          Level 7
          I've only tested superficially, but how about this:

          <cfquery.*?>.*?\b(emplid|emplno|empl_no|empno|emp_no|deptid|dept|department)\b.*?</cfquery >

          This matches any usage of those columns in a <cfquery>, not simply in the
          where clauses. I'm not sure if this is sufficient. You could modify to be
          this, I suppose:

          <cfquery.*?>.*?where.*?\b(emplid|emplno|empl_no|empno|emp_no|deptid|dept|department)\b.*?< /cfquery>

          (I tested that one even less thoroughly, sorry)

          If you are using the cols in stored procedures, you'd neen a variation on
          the same theme.

          Suggestion: organise your code so that DB interaction is isolated into
          separate files (like CFCs, if possible), so that when you need to do this
          sort of thing, you only need to look at a very small subset of your

          • 2. Regular Expressions
            KCPLCF Level 1
            Actually this does not work, but it is a good start. I may have some other issues with permissions too. I'll keep you posted though.

            >>Thanks Adam. This worked great. Appreciate the assistance.