How to Determine iframe by Regular Expression

Asked 2 years ago, Updated 2 years ago, 123 views

Is it the following code that determines whether the url entered is Googlemap iframe?

preg_match("/<iframe src=\"https:\/\/www\.google\.com\/map(.*?)<\/iframe>/s", $map, $is_map);

  if(!isset($is_map[1])){
    echo"Map embedded code is incorrect.";
  } else {
    echo "This is the correct map.";
 }

I have created a system to enter url for the map, so I want to eliminate it when I enter code other than the map.

php html5 regular-expression

2022-09-30 21:18

1 Answers

preg_match("/<iframe src=\"https:\/\/www\.google\.com\/map(.*?)<\/iframe>/s", $map, $is_map);


2022-09-30 21:18

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.