Get all the URLs of the pages that uses a specific shortcode

Solution that I’ve found:

  $pages = get_pages();
  $pattern = get_shortcode_regex();

  foreach($pages as $page) {
    if ( preg_match_all( "https://wordpress.stackexchange.com/". $pattern .'/s', $page->post_content, $matches )
      && array_key_exists( 2, $matches )
      && in_array( 'my_shortcode', $matches[2] ) )
    {
      echo $page->post_title . <br />;
    }
  }