-1

I want to split a paragraph of text using regex, but /\W+/ splits can't into can and t.
Is there any way to define a regular expression that splits whenever a character other than a-z,A-Z,0-9 and '(single quotes) is encountered?

 text=text.split(/\W+/);
Yaron Schwimmer
  • 5,327
  • 5
  • 36
  • 59
alvinz20
  • 1
  • 1

1 Answers1

0

The following regex splits on everything you asked for , that is a-z, A-Z, 0-9, and ' :

text=text.split(/[^a-zA-Z0-9\']/);