[thelist] Detecting HTML tags with Regular Expressions.

Hassan Schroeder hassan at webtuitive.com
Tue May 8 10:00:57 CDT 2001


Sam-I-Am wrote:

> I tend to steer clear of .* as it doesn't (normally) match on newlines,
> and occassionally you see
> <img
>         src="this.gif"
>         name="that"
>         onmousover="something()"
>         alt="alt">
> 
> which is perfectly valid. In perl you can alter this behaviour so .*
> would work, I don't know a way in javascript.

RegExp.multiline = true;

/* from the JavaScript 1.3 Client-Side Reference */

multiline 

Reflects whether or not to search in strings across multiple lines. $* is another
name for the same property. 
 Property of
                RegExp
 Static
 Implemented in
                JavaScript 1.2, NES 3.0


Description 

Because multiline is static, it is not a property of an individual regular expression
object. Instead, you always use it as RegExp.multiline.

The value of multiline is true if multiple lines are searched, false if searches must
stop at line breaks. 

The script or the browser can preset the multiline property. When an event
handler is called for a TEXTAREA form element, the browser sets multiline to true.
multiline is cleared after the event handler completes. This means that, if you've
preset multiline to true, it is reset to false after the execution of any event handler.

/* end of Reference extract */

-- 
H*
Hassan Schroeder ----------------------------- hassan at webtuitive.com 
Webtuitive Design ---(+1) 408-938-0567 --- http://www.webtuitive.com

    -- creating dynamic Web sites and applications since 1994 --




More information about the thelist mailing list