WLJS LogoWLJS Notebook

RegularExpression

RegularExpression["regex"] represents the generalized regular expression specified by the string "regex".

Examples

Match digits in a string:

StringCases["abc123def", RegularExpression["[0-9]+"]]
(* {"123"} *)

Replace using regex:

StringReplace["hello world", RegularExpression["\\s+"] -> "-"]
(* "hello-world" *)

Please visit the official Wolfram Language Reference for more details.

On this page