Damien wrote:
>Sounds dangerous - wouldn't it be better to scan the field for only
>valid characters. Or is every possible character valid except for * and
>%? Sounds a bit unusual.
>
>^([^*%]|\n)*$
When we're talking about a field, I wouldn't assume that a complete line
is meant; so I think the \n shouldn't be an option here. Also, if the
field is being scanned in the context of a complete line of text (ie,
standing between other fields), the line start and end markers would have
to be left out. Just my personal preference, of course, but I would have
given the example as
[^*%]+
This makes no assumptions whatsoever, apart from the fact that the field
should be comprised of at least one character that's not a * or a %.
Obviously, if the OP would be using the expression in a larger context, it
would have to be modified accordingly.
And I second the notion that it's unusual to exclude only these two
characters in what sounds like a query string to me :-)
Oliver Sturm
--
Expert programming and consulting services available
See
http://www.sturmnet.org (try /blog as well)