The i modifier makes the pattern case insensitive.
Modifier Effect
i Ignore case.
s
By default the period character, '.', matches anything except newline characters.
This modifier makes the period character match newline characters as well.
Error Handling and Security
[ 322 ]
Modifier Effect
m
Makes the caret ^ and dollar characters match the start and end of line
characters as well as string start and end.
x
Whitespace is ignored, unless it is in a character class. Allows comments in the
pattern; comments are signified by the hash character #. Do not use the pattern
delimiters within comments.
u
This modifier makes the pattern UTF-8 aware; this is only available with PHP
4.1.0 and above.
Matching
It's all very well knowing how to write RE patterns, but how do we use them?
PHP provides us with a selection of different functions that use REs. We'll begin
by looking at preg_match(); this function searches for matches in the subject and
returns an the number of times the pattern was matched.
Pages:
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443