Avatar of Errol Farro
Errol Farro
Flag for Aruba asked on

Specific String search Coldfusion

Hi all,

Can someone help me create the following CF Function?

We receive payments from clients but the client number can be anywhere in the description.
The naming convention of the client number is: yyyynnn where yyyy is the year and nnn is a sequence number between 001 and 999. The year can be between 1960 and the current year. There may be other numbers in the description but the client number should be returned only when the above criteria is met.

Thanks in advance.

Errol
ColdFusion Language

Avatar of undefined
Last Comment
_agx_

8/22/2022 - Mon
_agx_

You'll likely need a regex. You should add that topic to the question tags to attract attention from the right experts. (I'm not a regex guru so I'll leave this to someone more qualified :)
ASKER CERTIFIED SOLUTION
Sudhindra A N

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Errol Farro

ASKER
Thanks a lot Ansudhindra. Works like a charm....
_agx_

> "[\d]+"

May as well search for 7 digits exactly instead of *any* number of digits.

And if you go with a cffunction, don't forget to VAR scope all those variables... or you can end up creating weird threading bugs in some cases.
Your help has saved me hundreds of hours of internet surfing.
fblack61