The string is setup like so:
href="PART I WANT TO EXTRACT">[link]
Here's another way in Bash:
$ string="href="PART I WANT TO EXTRACT">[link]"
$ entity="""
$ string=${string#*${entity}*}
$ string=${string%*${entity}*}
$ echo $string
PART I WANT TO EXTRACT
This illustrates two features: Remove matching prefix/suffix pattern and the use of a variable to hold the pattern (you could use a literal instead).
grep -o "PART I WANT TO EXTRACT" foo
Edit: "PART I WANT TO EXTRACT" can be a regex, i.e.:
grep -o http://[a-z/.]* foo
grep -o 'http://[a-z/.A-Z0-9]*">\[link\]' but it's giving me: > http://img18.imageshack.us/img18/8079/69903601.jpg">[link] I don't want the stuff on the end.