| ‘/hello/’ |
It will match the word hello |
| ‘/^hello/’ |
It will match hello at the start of a string. Possible matches are hello or helloworld, but not worldhello |
| ‘/hello$/’ |
It will match hello at the end of a string. |
| ‘/he.o/’ |
It will match any character between he and o. Possible matches are helo or heyo, but not hello |
| ‘/he?llo/’ |
It will match either llo or hello |
| ‘/hello+/’ |
It will match hello on or more time. E.g. hello or hellohello |
| ‘/he*llo/’ |
Matches llo, hello or hehello, but not hellooo |
| ‘/hello |
world/’ |
It will either match the word hello or world |
| ‘/(A-Z)/’ |
Using it with the hyphen character, this pattern will match every uppercase character from A to Z. E.g. A, B, C… |
| ‘/[abc]/’ |
It will match any single character a, b or c |
| ‘/abc{1}/’ |
Matches precisely one c character after the characters ab. E.g. matches abc, but not abcc |
| ‘/abc{1,}/’ |
Matches one or more c character after the characters ab. E.g. matches abc or abcc |
| ‘/abc{2,4}/’ |
Matches between two and four c character after the characters ab. E.g. matches abcc, abccc or abcccc, but not abc |