search

Home  >  Q&A  >  body text

javascript - What is the difference between regular expressions written inside square brackets and written outside?

For example, what is the difference between [\s] and \s?

phpcn_u1582phpcn_u15822798 days ago879

reply all(3)I'll reply

  • 阿神

    阿神2017-06-26 10:54:47

    [ab] means or , one of a or b, representing a character set

    ab means and , a and b appear at the same time, and ab is continuous.

    reply
    0
  • typecho

    typecho2017-06-26 10:54:47

    Do you have to ask this kind of question? Do you understand that Baidu can take 5 minutes?

    reply
    0
  • 怪我咯

    怪我咯2017-06-26 10:54:47

    There is no difference between

    [s] and s. They both represent space characters

    [abc] As long as one of abc appears
    abc must be three consecutive abcs

    reply
    0
  • Cancelreply