Regular Expression is used to extract a substring from a string. To learn more about regular expressions see RegExr.
Match 0.Multiple is checked. Escape sequences as \n\r\t can be used.Extract text that is before or after specific keywords.
By using capture groups, it is easier to extract a specific string from the text without writing complicated regular expressions.
| text | regex | capture group | result |
|---|---|---|---|
| price: $14.99 inc.VAT | price:\s+([^\s]+) |
1 | $14.99 |
| 4.2 out of 5 stars | ([^\s]+) out of |
1 | 4.2 |
| date: 2014-08-20 | \d+-\d+-\d+ |
0 | 2014-08-20 |