I added a couple of regular expression validators to my asp fields but
I am having difficulty coming up with a regular expression for this,
anyone have any suggestions?
My RegEx-Fu is very poor.

Any kind of latitude / longitude regular expression would be nice,
preferably one that uses the signed and unsigned decimal as opposed to
cardinal direction.
I have googled this for a while but can't find any example to use as a
good starting point.

(\d{1,3}  \d{1,2}\.\d{1,2} [NSEW])
latitude or longitude coordinates in the form 46 37.73 N

but I would rather have this be something closer to:
46°37'73" (46 37.73 S would be better as -46°37'73")

Again, any feedback is appreciated.



On Dec 16, 3:05 pm, Sharp ArunKumar <[email protected]> wrote:
> Your validation easly made by various string functions,First you valid
> the data then you can format the data as you like.
> First input data Split into  three value , Assume user give  45.0003
> in the LLtextBox
>
> Then you can split the value into two look the following C# code
>
>    string[] s ;
>    s = LLtextBox.Text.Split('.');
>    int  Longitude= Convert.ToInt16(s[0]); //45
>    int Latitude= Convert.ToInt16(s[1]); //0003
>    //then again latitude value into two using substring functions
>    string v1= s[1].Substring(0, 2); //00
>    string v2= s[1].Substring(2); //03
> if user give less then three digit value eg 87
>  call above split function
> now s[0] contain 87
> but s[1] contain Null value ,then you can assign default value
> Then you can format the data using string functions like insertchar
> -----------------------
> Arun Kumar
>
> On Dec 16, 9:36 pm, rhaazy <[email protected]> wrote:
>
>
>
> > Thanks for your reply.
>
> > The data entered will no larger than 7 numbers with 4 always to the
> > right of the decimal.
> > A valid Latitude value is -90 to 90
>
> > A valid Longitude value is -180 to 180
>
> > the minutes and seconds must be no larger than 59.
>
> > A few more examples
>
> > 45.0003 -> 45°0'3"
> > -145.3453 -> -145°34'53"
> > 123.7592" -> 124°16'32" - this example rounds to get rid of invalid
> > minutes/seconds
> > 87 -> 87°0'0"
> > -23.59 -> 23°59'0" (this number will be saved to database as -23.5900
>
> > Besides the validation I am trying to figure out how the text will get
> > formated.
> > My thoughts are that I would have to create some kind of "on leave"
> > logic for the textbox.
> > Is there a way to mask the input of the textbox in asp.net?
>
> > On Dec 16, 11:03 am, Cerebrus <[email protected]> wrote:
>
> > > You should be able to do it easily using RegexValidators or
> > > CustomValidators. Or write your own textbox controls that encapsulate
> > > the behaviour required.
>
> > > If you need help with the Regex, please provide more details/examples
> > > on the type of data that is valid and invalid.
>
> > > On Dec 16, 8:23 pm, rhaazy <[email protected]> wrote:
>
> > > > Forgot to add that this is asp.net
> > > > Data input will be like 123.4523 -> 123°45'23"
>
> > > > On Dec 16, 9:54 am, rhaazy <[email protected]> wrote:
>
> > > > > I have to add a couple of controls to my form for input of
> > > > > geographical cooridinates(Degrees Minutes Seconds)
>
> > > > > I was wondering if anyone here has some useful suggestions for input
> > > > > controls or data validation.
>
> > > > > I've been searching the google for a while but can't find anything
> > > > > very useful.
>
> > > > > Thanks.- Hide quoted text -
>
> > > > - Show quoted text -- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

Reply via email to