To create a regular expression to extract numbers, you can use the `d+` pattern to match one or more digits in the text. For example, the regular expression `d+` will match all numbers in the text regardless of their length.