Solved

Question about using rereplacenocase

Posted on 2002-06-12
4
136 Views
Last Modified: 2013-12-24
Hi Everyone:

I have the following var ThisVar= foo_1_bar

I'd like to dynamically extract foo_ and _bar.
And store the new value (1) in a new var.

Using this <cfset ThisNewVar= rereplacenocase ThisVar,"foo_","","ALL")>

I am able to extract the foo_ regular expression.

I could not find a way to extract both regular expressions (foo and bar) and store the new value in the new var(ThisNewVar).

Any help would be appreciated

Thanks

Nickel    
0
Comment
Question by:nickel2001
  • 2
4 Comments
 
LVL 17

Expert Comment

by:anandkp
ID: 7074693
Hi there,

following is the ans - from what i could understand of ur Q's.

Create Dynamic variables ...

U could <CFSET ThisVar = "foo_#Val#_bar">

Now when u r in a loop - u will have the values of val being chanegd dynamically & so everytime ur Thisvar varible would be different.

then u could evaluate(ThisVar) to get new value each time in the loop.

let me know if this helps - or u need more clarification in this.

Regards
Anand
 
0
 

Author Comment

by:nickel2001
ID: 7076523
thanks for your help
0
 
LVL 2

Accepted Solution

by:
hammond_david earned 100 total points
ID: 7082025
I understood the question differently than the last person to comment.  What I thought you wanted to do was the following:

<cfset ThisNewVar = REReplaceNoCase(ThisVar,"foo_([^_]*)_bar","\1")>

This would set ThisNewVar to the string between "foo_" and "_bar", assuming that it does not contain and underscore character.  "\1" is a replacement expression referencing the first portion of the regular expression enclosed in parenthesis "[^_]*".

Hope that helps
- David
0
 

Author Comment

by:nickel2001
ID: 7083859
David:

I solved the problem with two expressions

<cfset ThisNewVar= rereplacenocase (ThisVar,"foo_","","ALL")>
<cfset ThisNewVar= rereplacenocase (ThisNewVar,"_bar","","ALL")>

Did not try out your idea yet.

Thanks for your help

Nickel
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
json_decode return null? 8 87
nginx with multiple websites --need help with phpmyadmin please 5 60
Application launch issue with Apache Tomcat 5 43
Problem to Eclipse 16 125
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question