1

In this javascript code I have this row:

   var regex = /\s+/gi;

Any idea what is the maning of this:

/\s+/gi

Thank you in advance.

nhahtdh
  • 52,949
  • 15
  • 113
  • 149
Michael
  • 11,410
  • 43
  • 120
  • 228

2 Answers2

1

Here is a must read for same https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions

Regular expressions are patterns used to match character combinations in strings. In JavaScript, regular expressions are also objects. These patterns are used with the exec and test methods of RegExp, and with the match, replace, search, and split methods of String. This chapter describes JavaScript regular expressions.

Saqueib
  • 3,382
  • 2
  • 26
  • 52
0

Here, each contiguous string of space characters is being replaced with the empty string

For more details refer :- Is there a difference between /\s/g and /\s+/g?

Community
  • 1
  • 1
Panther
  • 3,124
  • 9
  • 25
  • 47