Answer == Answer.trim().match(/^No Miss|No Ma'am|no|no Sir|No *goddess$/i)
But for some reason when I type 'no goddess' it doesn't work and if I type 'no' it does work
Why it doesn't validate the 'goddess' after each string I've specified

Tried it out in javascript tester, I think the issue is that if you put "No goddess" (and the same is true for "No Sir"), it matches the simple "no" options, which then fails the comparison check; try putting the "no" option last, should workEpton wrote: Tue Aug 13, 2024 9:01 pm Hey Guys, I'm using Prompt and give it a Variable 'Answer' then I use an IF with
Answer == Answer.trim().match(/^No Miss|No Ma'am|no|no Sir|No *goddess$/i)
But for some reason when I type 'no goddess' it doesn't work and if I type 'no' it does work![]()
Why it doesn't validate the 'goddess' after each string I've specified![]()
![]()
Maybe it was cuz of the 2 no, but I deleted the middle one and it weirdly worked, but I noticed something very wrong with what I had written so I changed it lol. Thanks for the answer, it clarified my mind.Thamrill wrote: Wed Aug 14, 2024 7:32 amTried it out in javascript tester, I think the issue is that if you put "No goddess" (and the same is true for "No Sir"), it matches the simple "no" options, which then fails the comparison check; try putting the "no" option last, should workEpton wrote: Tue Aug 13, 2024 9:01 pm Hey Guys, I'm using Prompt and give it a Variable 'Answer' then I use an IF with
Answer == Answer.trim().match(/^No Miss|No Ma'am|no|no Sir|No *goddess$/i)
But for some reason when I type 'no goddess' it doesn't work and if I type 'no' it does work![]()
Why it doesn't validate the 'goddess' after each string I've specified![]()
![]()

Code: Select all
Answer == Answer.trim().match(/^No Miss|No Ma'am|no|no Sir|No *goddess$/i)
Code: Select all
null != Answer.trim().match(/^No Miss|No Ma'am|no|no Sir|No *goddess$/i)
Code: Select all
null != Answer.trim().match(/^no( +(Miss|Ma'am|Sir|goddess))?$/i)
Code: Select all
Answer.trim().match(/^no( +(Miss|Ma'am|Sir|*goddess))?$/i)