Preg_match problems
Want to see if there are "Rpt_" or "Ods_" or "dw_" in the table string, and if so, take this matching string and put it in an array, I'm doing it.
$table = "S_dw_xxdf_aw_aaas";
Preg_match ('/rpt_|ods_|dw_|/i ', $table, $arr);
Print_r ($arr);
But for what, the printed array is
(
[0] = =
)
------Solution--------------------
------Solution--------------------
, the landlord's regular expression matches an empty string
Preg_match ('/rpt_
------Solution--------------------
Ods_
------Solution--------------------
Dw_/i ', $table, $arr);
------Solution--------------------
Preg_match matches the regular expression, matches only once, returns 1, otherwise 0,
Format: Preg_match ("Regular expression", "matched string", variable name that holds the result, preg_offset_capture, starting offset)
Where: Preg_offset_capture means get match index location
Start offset: Matches from the specified position
Preg_match_all--a global regular expression match that returns the total number of matches. As in the above, the difference is the match to the last.