cfswitch tag not working the same as cfscript switch

Description

Additionally, I would assume that this code below should also work ( currently throws an exception!! )

Environment

None

Activity

Show:
Arthur
February 27, 2020, 12:36 PM

I disagree! I use regex in switch statements in JavaScript all the time for efficiency. In the matter of fact most modern languages allow that!

Zac Spitzer
February 27, 2020, 1:19 PM

can you post the source as a trycf gist?

Arthur
February 27, 2020, 1:25 PM

 

Zac Spitzer
February 27, 2020, 1:50 PM
Arthur
February 27, 2020, 2:00 PM
Edited

the switch() must evaluate to true or 1 otherwise its pointless. The idea is that the regex will return true or false. In this particular case the regex returns the position which is 1, so true also works

But generally speaking if the regex is written differently the switch statement must react to true value only

if that makes sense.

Assignee

Michael Offner

Reporter

Arthur

Priority

New

Labels

None

Fix versions

None

Affects versions

Configure