I don't see anything inherently wrong with the code, but since I don't know what the text you are parsing is, I can't say for sure whether that should work. For instance, it would not match any of the following:
<script type="text/javascript" src="fubar.js"> // additional attribute in tag
<script type="Text/JavaScript"> // upper-case letters
<script type='text/javascript'> // single quotes instead of double
Without understanding why you are doing this and what the source text might look like, it's difficult to provide a "best" solution. The most robust might be something using the [man]DOM[/man] extension if you are parsing an entire, reasonably valid [X]HTML page, or you may need to so something with the [man]preg_replace/man function so that you can use the flexibility of regular expressions.