Re: Generic file name validation code?
- From: Eric Sosman <esosman@xxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 02 Sep 2007 10:40:00 -0400
Arne Vajhøj wrote:
harryajh wrote:On 2 Sep, 12:40, Roedy Green <see_webs...@xxxxxxxxxxxxxxxxxxxx> wrote:> Pattern p = Pattern.compile("([A-Z]|[a-z]|[0-9])+.con");On Sun, 02 Sep 2007 11:15:34 GMT, "harry" <a...@xxxxxxx> wrote, quoted or
indirectly quoted someone who said :Does anybody know of java code that does this?If you limited the name to A-Z a-z 0-9 . it would work on anything
without a tight length limit anything.
Thanks Roedy, this seems to do the job (forgot to say file name must
end with "con")
That can be abbreviated to:
Pattern p = Pattern.compile("([A-Za-z0-9])+.con");
Better quote that . character ... Also, the ( ) can be
eliminated if the O.P. doesn't need the capturing group.
--
Eric Sosman
esosman@xxxxxxxxxxxxxxxxxxxx
.
- Follow-Ups:
- Re: Generic file name validation code?
- From: Arne Vajhøj
- Re: Generic file name validation code?
- References:
- Generic file name validation code?
- From: harry
- Re: Generic file name validation code?
- From: Roedy Green
- Re: Generic file name validation code?
- From: harryajh
- Re: Generic file name validation code?
- From: Arne Vajhøj
- Generic file name validation code?
- Prev by Date: Reverse engineer class diagram
- Next by Date: Re: Reverse engineer class diagram
- Previous by thread: Re: Generic file name validation code?
- Next by thread: Re: Generic file name validation code?
- Index(es):
Relevant Pages
|