Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8092695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:20:29+00:00 2026-06-05T20:20:29+00:00

I confess at the outset that I dislike and don’t really understand regex properly.

  • 0

I confess at the outset that I dislike and don’t really understand regex properly. I want to check that a single character ch is one of a set of acceptable characters. I thought this should work, but it doesn’t:

if (/aCcehIikmNnOoprSstxYy/.test(ch)) {

What am I doing wrong?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T20:20:30+00:00Added an answer on June 5, 2026 at 8:20 pm

    I think this can be solved without regex:

    var characters = "aCcehIikmNnOoprSstxYy";
    var allowed    = characters.indexOf("C") != -1;
    
    if (allowed) {
      // do something here
    }
    

    String.indexOf() returns -1 if character is not in string, otherwise positive number.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying understand how multi queries work in mysqli. But I confess that
I will confess I'm very new to Python and I don't really know what
OK, I confess at the outset I'm over my head a bit here. I've
I have to confess that I hate membership provider. The default implementation is not
I must confess that today is my first day using either Sweave or LaTeX.
I have to confess that I cannot work out how to complete this. I
Well, first of all , I have to confess, I've really didn't implemented linked-list,
I confess I'm having a really bad time here. I have a C program
I understand that the default term frequency (tf) is simply calculated as the sqrt
I'm going to confess I don't know what's best. Normally, I place the jquery

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.