If
we wanted to search for the occurrence of the term 'monkey' our pattern would look
like this: /monkey/. This example will search for 'monkey' anywhere in our data; we
can restrict this pattern further using the caret ^ and dollar $ characters. If we place
the caret ^ character at the start of the pattern, it means that the 'data must start with'
/^monkey/ (includes start of line and start of string). If we put a dollar sign at the
end of the pattern it means that the 'data must end at' /monkey$/ (includes end of
line and end of value).
We can, if we choose to, combine the caret character and the dollar character
/^monkey$/; this is the same as asking, is the data equivalent to the string 'monkey'?
In this context it is relatively useless, because we would use $data == 'monkey'.
A character class is a way of defining multiple characters that can be matched to just
one actual character. If we wanted to search for 'monkey' or 'fonkey' we can define a
character class that consists of the characters 'm' and 'f'.
Pages:
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440