For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Freelance > November 2004 > RegExp to find pos in str of invalid chars









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author RegExp to find pos in str of invalid chars
Ron Brennan

2004-11-20, 3:56 pm

Good morning.

I would like to use one or more RegExps to validate country names as having
the first and last words beginning with an uppercase letter, intermediate
words beginning with either uppercase or lowercase, and all other characters
being lowercase characters. For example:

Turks and Caicos

The difficult part is that I want to obtain save the string positions of the
invalid characters in an array, rather than just obtain a true or false
value.

Can anybody with more experience with Regular Expressions than me suggest
some code, sites, or approaches.

Thanks,
Ron




Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com