liveBook · Manning

Regular expression

As explained in Deep Learning with R, Third Edition

A regular expression is a pattern notation for matching and manipulating sequences of characters.

A regular expression is a flexible pattern notation for expressing string operations, especially for splitting text into tokens such as characters or words. section 14.2

Keep words, punctuation, and non-whitespace elements

In stringr, split text at word boundaries with skip_word_none = FALSE, then use the regex \\S to retain elements that are not whitespace. The result can include words and punctuation as separate tokens. section 14.2

How Deep Learning with R, Third Edition covers it

How deep it goes
Defines flexible pattern matching and demonstrates \\S, but defers systematic regex instruction to external references.
Examples
Demonstrates splitting a sentence into characters, words, punctuation, and vocabulary indices.
What it assumes
Assumes basic string processing and recommends learning regex separately because systematic instruction is out of scope.
What you can do after
Apply it via stringr to retain non-whitespace tokens and punctuation while splitting text.
How it connects
Connects regular expressions to tokenization, text preprocessing, and string operations.

Also explained in

Compare how 27 books explain regular expression →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with R, Third Edition. The section links point to the parts of the book it draws on.