Splitting unicode sentence into words array using XRegExp

149 Views Asked by At

I'm using following script for splitting Unicode sentence into words array.

XRegExp.matchChain("læseWEB læser teksten på dit website op.", [XRegExp("[\\p{Alphabetic}\\p{Nd}\\{Pc}\\p{M}]+", "g")])


[ "læseWEB", "læser", "teksten", "på", "dit", "website", "op" ]

Now I'm expecting

['læseWEB ', 'læser ', 'teksten ', 'på ', 'dit ', 'website ', 'op.'].

Someone said I need to use split function instead of matchChain.

Any suggestions?

0

There are 0 best solutions below