Copy link to clipboard
Copied
Hello, all,
I think I may have posted regarding this issue, before, but didn't get any response; I (unfortunately) have to try, again.
I am using a Regular Expression to map the full physical location on the HD of where the website is located. I need this for a CFFILE tag.
The reason I'm using a RegEx instead of hard coding the location is because the location varies depending upon whether it is being used in development, staging, or production. (Yeah, I know.. all three should be mirrors of each other - I'm working on that. )
For example, our DEV environment needs the CFFILE tag to point to E:\ColdFusion10\cfusion\wwwroot\www\ folder.
Our staging environment needs the CFFILE tag to point to C:\ColdFusion10\cfusion\www\ folder.
Our production environment needs the CFFILE to point to F:\webdocs\cf\www\docs\ folder.
I really do NOT want to be hackish about this and use a CFIF or CFSWITCH to set the "this.webrootmapping" variable. Besides, if anything gets changed, I'd have to go in and change the code. Not ideal.
So, I'm using a RegEx. I'm also setting it so that it will always point to the ROOT, no matter what sub-folder the user is in.
What I have (and isn't working for the production environment) is:
<cfset this.webrootmapping = REreplaceNoCase(ExpandPath('./'),
'(.+[\\|\/]www([\\|\/]docs)?[\\|\/])(.+)',
'\1',
'all') />
What this is supposed to do is accept everything up to the "www" folder, or up to "www\docs" folder, and remove everything after that.
It's working in dev and staging; it is NOT working in production (where the root ends in "\docs\".) The question mark should be indicating "zero or one of \docs". But it isn't.
Any insight greatly appreciated.
V/r,
^_^
1 Correct answer
*headdesk*
*headdesk*
*headdesk*
*headdesk*
*headdesk*
*HEADDESK*
It is starting to slowly kill me, the way I type it all out and then it somehow solves itself.
*headdesk*
*headdesk*
*headdesk*
I did experiment with something VERY, VERY simple, and it is now resolved.
*headdesk*
*headdesk*
*headdesk*
I will share it with you, after I'm done banging my head into my desk.
*headdesk*
*headdesk*
*headdesk*
*headdesk*
*headdesk*
*headdesk*
*headdesk*
*headdesk*
*headdesk*
*headdesk*
The last '+' (one or more) was replaced wi
...Copy link to clipboard
Copied
*headdesk*
*headdesk*
*headdesk*
*headdesk*
*headdesk*
*HEADDESK*
It is starting to slowly kill me, the way I type it all out and then it somehow solves itself.
*headdesk*
*headdesk*
*headdesk*
I did experiment with something VERY, VERY simple, and it is now resolved.
*headdesk*
*headdesk*
*headdesk*
I will share it with you, after I'm done banging my head into my desk.
*headdesk*
*headdesk*
*headdesk*
*headdesk*
*headdesk*
*headdesk*
*headdesk*
*headdesk*
*headdesk*
*headdesk*
The last '+' (one or more) was replaced with '*' (zero or more), and it worked. Just in case anyone else runs across this problem and spends weeks or months trying to figure it out.
*headdesk*
*headdesk*
*headdesk*
I need a nap, now.
*headdesk*
*headdesk*
*headdesk*
Good night.
V/r,
^_^
*headdesk*
*headdesk*
*headdesk*

