Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
suntin #1
REFindNoCase with variable length string
regexpClause = "REFindNoCase('^[0-9\-\+\(\)]{" & numLength & "}+$',str)";
if (regexpClause) {
return true;
}
It errors out saying the expression needs a constant value. as I am expecting
1 of 2 possible string lengths I need to use a variable rather than hardcoding
a number into the expression. Has anyone tried this before or know of a
succesful way to do it?
suntin Guest
-
Getting last 5 chars of variable length string
TIA for any help on this. I have a database field that is a variable length string. I need to process some stuff IF and only if the string ends in... -
string length
how do you find the length of a string in php?? there seems to be every command under the sun in the manual to operate on strings but not one for... -
a string length problem
I am using Director 8 on Chinese version Windows system,a double-byte system. and I have a problem about the length of chinese character string ,... -
V12 length string problem
This is my problem: i have a db (ms access) with a type "memo". In this field i have a very long text. In access i see the text correctly, but, when... -
How to get length of string? length() problems
Simplified a bit, I'm parsing HTML documents to get sentences e.g. my $html = get($URL); # remove all HTML TAGs...blah blah blah @sentences =... -
Adam Cameron #2
Re: REFindNoCase with variable length string
On Thu, 21 Apr 2005 06:57:05 +0000 (UTC), suntin wrote:
Can you combine {} and + as a modifier for a character set? {x} means> regexpClause = "REFindNoCase('^[0-9\-\+\(\)]{" & numLength & "}+$',str)";
exactly x times. + means one or more times. Which is it? Or does {x}+
one or more groups of those (exactly) five chars? Regex coach says that's
not allowed. NOt that Regex Coach is for specifically testing
CF-implemented regexes, but it looks odd to me too.
But let's ignore that for the time being...
Have you tried creating the regex as a separate string, first?> It errors out saying the expression needs a constant value. as I am expecting
> 1 of 2 possible string lengths
regex = '^[0-9\-\+\(\)]{" & numLength & "}+$';
regexpClause = "REFindNoCase(regex, str)"; // I'm guessing you're
evaluating this at some point?
(sorry, I'd normally test these suggestions before making them, but I'm in
a rush to get out the door and into the sunshine today ;-)
--
Adam
Adam Cameron Guest
-
suntin #3
Re: REFindNoCase with variable length string
ohhh, to be out in the sunshine....
I've tried to do do the following:
if (eval("REFindNoCase('^[0-9\-\+\(\)]{" & numLength & "}+$',str)")) {
return true;
}
regexpClause = "REFindNoCase('^[0-9\-\+\(\)]{" & numLength & "}+$',str)";
if (regexpClause) {
return true;
}
regexpClause = "^[0-9\-\+\(\)]{"&numLength&"}+$";
if (REFindNoCase(regexpClause,str)) {
return true;
}
It doesn't "appear" to mind the + symbol, instead it is saying that it
requires a constant not a variable. I fear this may be exactly as it says and
simply a coldfusion limitation so I just ended up writing two seperate
functions (1 for each expected string length) but oh how the good developer
inside me weeps...
suntin Guest



Reply With Quote

