Home > Archive > PERL Programming > November 2004 > Starting out inreg expressions..
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Starting out inreg expressions..
|
|
|
| X-No-Archive: yes
I'm starting out in Regular Expressions and need help with something, how do
I say:
(This is just a banner ad and I want to search for the tag in any files:)
<!-- TAG BANNER START -->
anything between here as it can be a different banner code but the two tags
above are always present.
<!-- TAG BANNER END -->
Example, the banner code changes:
<!-- TAG BANNER START -->
<script language="javascript">
var uri = 'http://xxxx.xxxxxx.xxx/imp/js/848986/404265?' + new String
(Math.random()).substring (2, 11);
document.write('<sc'+'ript language="JavaScript" src="'+uri+'"
charset="ISO-8859-1"></sc'+'ript>');
</script>
<!-- TAG BANNER END -->
As a Reg. Exp ?
| |
| Toby Inkster 2004-11-29, 4:00 pm |
| 127.0.0.1 wrote:
> I'm starting out in Regular Expressions and need help with something, how do
> I say:
>
> <!-- TAG BANNER START -->
>
> anything between here as it can be a different banner code but the two tags
> above are always present.
>
> <!-- TAG BANNER END -->
Assuming Perl-compatible regular expressions, personally I'd match on:
/<!-- TAG BANNER START -->.*?<!-- TAG BANNER END -->/s
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
|
|
|
|
|