Randy Jonasz a écrit :
> Object.  The specific culprit was/is the regular expression saved in
> ScriptFragment: '(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)',  I
> changed this reg ex to
> '<script.*>(.*)<\/script>' and now safari loads and evaluates my javascript.

Note that this regex is altogether different.  The former one isolates
the contents of every script tag in your text, while yours takes
everything between the *first* opening script tag and the *last* closing
one.  If you take an XHTML fragment with multiple script tags (which
happens quite often), your regex will just fail miserably.

If you don't want to use the original one (although it is there for
sound reasons), at least try going with reluctant quantifiers instead of
greedy ones:

        <script.*?>(.*?)</script>

Also, the '(\n|\r|.)' instead of '.' is there because '.' is not
supposed to be multi-line.  Does your regex (or even mine) work on
script fragments spanning multiple lines?

-- 
Christophe Porteneuve a.k.a. TDD
"[They] did not know it was impossible, so they did it." --Mark Twain
Email: [EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to