Other Resources:
1 or 0 times repetition quantifier ?
What is the 1 or 0 times repetition quantifier? How to use it?
How to write a regular expression using a 1 or 0 times repetition quantifier to capture both spellings of skilful and skillful?
✍: FYIcenter.com
The "1 or 0 times" repetition quantifier allows us to create a special logical OR operation of "match the pattern unit or nothing". The "1 or 0 times" repetition quantifier character is '?' and it needs be placed immediately after the pattern unit. For example:
colou?r # repeat 'u' 1 or 0 times, same as colo(u|)r arm(strong)? # repeat 'strong' 1 or 0 times, same as arm(strong|)
The regular expression to capture both skilful and skillful is:
skill?ful
l? - repeat 'u' 1 or 0 times
2013-01-26, 0👍, 0💬
Popular Posts:
How to write a regular expression to parse key-value entries from Windows .INI files? Here is an exa...
All credit card numbers issued by JCB have 3 sets of numbers: JCB cards start with 2131 have 15 digi...
Are you having problems using regular expressions when processing text strings in your applications ...
How to capture the Sogou web spider entries from Web log file? Here are some Web log file entries: 1...
All credit card numbers issued by MasterCard must start with 51 through 55 and have 16 digits. For e...