Preceding Element {m}

Summary

{m} matches the preceding element exactly m times. The element can be:

Syntax

Semantics

Recommended Use

character(s){m}

 

Where one or more characters is followed by {m}

Use it to match the preceding character(s) exactly m times.

[character- range]{m}

Where a character range is followed by {m}

Use it to match the preceding character range exactly m times.

Examples

Example of query

Results

[0-9]{3}-[0-9]{4}

matches local phone number: 123-4567

[0-9]{3} - [0-9]{4}

Error: Open brace expected.

Solution: Do not use spaces!

[0-9]{7}

1234567, 123-4567, 1-999999, 22-4-1999

ISSN [0-9]{4}-[0-9]{4}

matches 'ISSN 4793-2940'

ISSN [0-9]{8}

matches 'ISSN 4-7932940', 'ISSN 47-932940', etc. The hyphen can be placed anywhere in the number.

ba{3}b

baaab

?{2}

is, us, de-facto, etc.

60{2}

600

Previous Topic

Next Topic