I'm trying to create a regular expression to get a certain match within a pair of HTML tags.
More detailed, I am trying to get a regular expression to get ID selectors for jQuery (in the format of
('this-is-my-ID')), but it can only grab it if it's between
</script>, and it needs to check if there's more than one set of script tags.
SO lets say we have the following code:
I need a regex that can take this entire data and replacePHP Code:
<p id="my_info" style="display:none;" class="some-class">
123 Spooner St.<BR>
Quahog, Rhode Island
my_infowithin the script tags.
Notice as well that one tag is
<script>, hence why I just said [ICODE<script[/ICODE] earlier.
The regex I've come up with can find it, however it selects everything, including the script tags.
I guess the new question now is how can I match a regex within two tags but only replace the searched data rather than everything in it? I'm trying to keep in mind that some of the page source may contain words that look like ID's so I don't want those replaced, even though they should show with
"rather than the actual characters.