Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion TouchDB-Android - Help to understand TDServer.pathForName
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
bsquared  
View profile  
 More options Nov 13 2012, 8:58 pm
From: bsquared <bwcod...@gmail.com>
Date: Tue, 13 Nov 2012 17:58:45 -0800
Local: Tues, Nov 13 2012 8:58 pm
Subject: Re: TouchDB-Android - Help to understand TDServer.pathForName
On 11/13/2012 02:52 PM, Marty Schoch wrote:

> The purpose of this block of code is to determine if the database name is
> valid.

> The regular expression works as follows, first we defined a string
> containing all the legal characters:

Valid database name or valid filename?

I worked out valid filename as this.
LEGAL_CHARACTERS = "[^\\w\\d_$/+-]*$";

These characters that are not in the original are also valid filename
characters on android /data file system.
~%^

> LEGAL_CHARACTERS = "abcdefghijklmnopqrstuvwxyz0123456789_$()+-/";

> Then the regular expression is evaluated as:

> Pattern.matches("^" + LEGAL_CHARACTERS, name)

> By prefixing the LEGAL_CHARACTERS string with "^" we are saying match any
> character that is NOT LEGAL.  It matches any single character, which is
> what we want because any database name containing even a single
> illegal-character is invalid.

> The remaining checks are for null, empty string, and also ensuring that the
> first character is lowercase.

> marty

--
Regards,
Brian

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.