View Single Post

  #9 (permalink)  
Old 10-30-2006
John Dunlop
 
Posts: n/a
Default Re: Help me with a regular expression for PHP

BKDotCom:

> Pedro Graca wrote:
>
> > The following line is perfectly valid HTML (I think in any version)
> >
> > <input type="text" name="x><y" id="xy">


Yes, yes it is. In any version.

> I would have to disagree


Run it through a validator. You'll find it's valid.

The 'name' attribute is defined as CDATA, so pretty much anything goes
if the attribute value is quoted, including literal less-than and
greater-than signs.

> <input type="text" name="x> is invalid: no closing quote around
> name value


Yes, as a start-tag _in itself_. That wasn't Pedro's example though;
his example was the whole

| <input type="text" name="x><y" id="xy">

> <y" id="xy"> is invalid. y" isn't a valid cname


As a tag in itself, it is invalid HTML, yes. It isn't invalid as part
of the example above.

> (only alphanumeric?)


Generic identifiers (aka, element type names) must begin with upper- or
lowercase letters.

> if you want 'x><y' as a value you'd need to use name="x&gt;&lt;y"


No. You only need to replace '<' and '>' with references where they
would be understood as something other than character data.

--
Jock

Reply With Quote