• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Regular Expressions

Community Beginner ,
Apr 16, 2007 Apr 16, 2007

Copy link to clipboard

Copied

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:
emplid|emplno|empl_no|empno|emp_no|deptid|dept|department

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

Any help will be appreciated, thanks ahead of time.

TOPICS
Advanced techniques

Views

215

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 17, 2007 Apr 17, 2007

Copy link to clipboard

Copied

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
templates.

--
Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 17, 2007 Apr 17, 2007

Copy link to clipboard

Copied

LATEST
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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation