This successfully groups words, but loses punctuation.Īs does Peter's even slicker Regex / /u Wiktor's suggestion is a big improvement, to separate the characters into a non-capturing group (?:a|b|c|d). I can group the words successfully, and group the gaps successfully by putting all bengali letters in a the string is split strictly with words and non-wordsīut I wish to split a string of foreign (Bengali) characters and these characters are not recognised by word boundaries. What I want is a zeroWidthWordDelimiter such that it behaves like splitting with word boundary, keeping spacing and punctuation seperate to words: string.split(/(?:\b)/gm) WordRegex = / /g // matches all English letters, ZeroWidthSplitter = /(?=e)/g //splits before every "e" I'm looking for an expression that combines two regexes: const string = 'Joe shouted, \"The pitchforks are coming!\"' Actually I can't get it to work in English either.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |