??? p$ matches any string with p at the end of it.
Still other flags can be inserted before and within a character sequence:
??? ^p matches any string with p at the beginning of it.
??? [^a-zA-Z] matches any string not containing any of the characters ranging
from a through z and A through Z.
??? p.p matches any string containing p, followed by any character, in turn followed
by another p.
You can also combine special characters to form more complex expressions. Consider
the following examples:
??? ^.{2}$ matches any string containing exactly two characters.
???
(.*) matches any string enclosed within
and .
??? p(hp)* matches any string containing a p followed by zero or more instances of the
sequence hp.
You may wish to search for these special characters in strings instead of using them in
the special context just described. To do so, the characters must be escaped with a backslash
(\). For example, if you want to search for a dollar amount, a plausible regular
expression would be as follows: ([\$])([0-9]+); that is, a dollar sign followed by one or
more integers. Notice the backslash preceding the dollar sign. Potential matches of this
regular expression include $42, $560, and $3.
Predefined Character Ranges (Character Classes)
For reasons of convenience, several predefined character ranges, also known as character
classes, are available.
Pages:
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312