*, ?, + (Occurrence characters)
|Top Previous Next|
Specifies the number of occurrences of the preceding character or group. In a regular expression there are four possible choices when trying to specify how many occurrences the regular expression should match to:
Zero or one, the '?' character.
Zero or many, the '*' character.
One or many, the '+' character.
Exactly one, the character itself not followed by any occurrence character.
If you entered the filename as the expression 'complaint ?doc' it would find all files that had the word 'complaint' followed by zero or one space followed by 'doc'. Therefore it would find files such as 'my complaint doc.doc' and 'mycomplaintdoc.txt', but would NOT find files such as 'my complaint_doc.doc' or 'my complaints doc.doc'.
If you entered the filename as the expression '^my.*doc$' it would find all files that began with the word 'my' followed by zero or more characters ending with 'doc' (note the use of '^' beginning of string, '.' any character, and '$' end of string special characters). Therefore it would find files such as 'my_note.doc', 'my_owndoc', and 'my_specialfile.doc' but would NOT find 'my_note.txt', 'thisis_my_note.doc'.
If you entered the filename as the expression '_file[0-9]+' would find all files that had the word '_file' followed by one or more numbers (note the use of '[' and ']' character list special characters). Therefore it would find files such as 'my_file245.doc' and 'the_file0023.txt' but would NOT find 'a_file_34.txt' or 'some_file 009.txt'.