Regular Expressions: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 29: | Line 29: | ||
|- | |- | ||
| ^055[1-9] || Matches any digits from 1 to 9 || 0551234 || 0550345 | | ^055[1-9] || Matches any digits from 1 to 9 || 0551234 || 0550345 | ||
|- | |||
| ^1?800 || Matches any number starting by 1 or not, ending with 800 || 1800, 800 || | | ^1?800 || Matches any number starting by 1 or not, ending with 800 || 1800, 800 || | ||
|} | |} |
Latest revision as of 14:47, 17 August 2017
Regular expressions are a powerful method of defining number ranges. They are used in several part of the system. Here some examples:
Regexp | Description | Matches | Not Matches |
---|---|---|---|
^05545$ | Set start and end of string | 05545 | 055453131 |
^05545 | Matches anything starting with 05545 | 0554531 0554566 | 5545 055 |
05545$ | Matches anything ending with 05545 | 998705545 | 055453 |
^055.* | Matches anything starting with 055 | 05545 | 99055 |
^0558*99 | Matches anything starting with 055 and with zero or more 8 and ending by 99 | 05588899
05599 || | |
^0557+ | Matches anything starting with 055 and with one or more 7 | 05577 0557 | 055 |
^0558?987 | Matches one or zero 8 inside the number | 0558987 055987 | 0558999 |
05546)99 | Matches either sequences | 0554599 0554699 | 0554799 |
^055(45)*99 | Matches zero or more instances of the sequences | 055454599 0554599 05599 | 05544599 |
^0559{3}8 | Matches a sequence of three 9 | 0559998 | 05599 |
^0559{2,3}8 | Matches from two to three sequence of 9 | 055998 0559998 | 05599998 |
^055[1-9] | Matches any digits from 1 to 9 | 0551234 | 0550345 |
^1?800 | Matches any number starting by 1 or not, ending with 800 | 1800, 800 |