I have a variable like this:
$post_content = get_the_content();
I have two requirements here:
1: I want a function to grab the first occurrence of any specific shortcode e.g [video] and returns that shortcode ONLY. Which can then be used in do_shortcode() optionally.
2: Remove the shortcode from the $post_content variable and leave the formatting of content intact.
How can this be done?
UPDATE 1:
Ok, regarding point one, i found a method which grabs any specific shortocode from the content and stores it in a variable. Here you can find the method: http://stackoverflow.com/questions/6290810/return-only-the-shortcode-from-post
check answer of: two7s_clash
But it works only if our shortcode is the first shortcode in that post, if there is any shortcode before it, it will not grab the shortcode.
UPDATE 2:
Found the solution for the first question. Now only want to know about second question