"be consistent" | |
PerlMonks |
Do I need to do escaping in my regex check?by stevieb (Canon) |
on Mar 14, 2022 at 14:14 UTC ( [id://11142083]=perlquestion: print w/replies, xml ) | Need Help?? |
stevieb has asked for the wisdom of the Perl Monks concerning the following question: Good day my fellow esteemed Monks! I come to you today with what I think is an easy one... I'm doing a validation check on input data, but I'm not getting expected results. Down deep in my software I've got the following sub, which compares a value against a list of enum type values. The important part for this discussion is the regex check:
Here's the test failure, which shows the actual value I'm trying to send in, along with the actual allowed values. You can see by eye that there's a match (the "isn't one of" is a joined string of the allowed values, separated by comma): Attribute PoweredBy is enum type but value 'None (Private Label)' isn't one of 'None (Private Label), Text, Banner, Extra' at tests/Email/035_email_model_broadcast.t line 199.Is this a failure due to the parens not being escaped? What's the best way to handle this? I'd rather not have to escape the input data, and I can't manually escape the allowed values in the sub above as the data is pulled from a database. Thanks, -stevieb
Back to
Seekers of Perl Wisdom
|
|