Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners > Regular Express...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 10944 of 12002
Post > Topic >>

Regular Expression Help

by chung.ley@[EMAIL PROTECTED] (Chung Ley) Apr 15, 2008 at 08:20 PM

------_=_NextPart_001_01C89F70.D96843D3
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi,

=20

I have a program that will take in a string that will resolve to a path
where the output is going to store.

=20

The path can includes "variables" in this format "%<VariableName>%".
The acceptable variableNames that the program will sup****t are fixed to
a list such as "Person", "Class", "Dept".  This list may grow in the
future; but for now it is fixed.

=20

So, some of the acceptable strings are:

C:\Windows\%Person%\%Class%

C:\MyHomeDir\%Dept%\%Person%

C:\MyHomeDir\%Dept%_%Person%

and etc...

=20

I like to develop a validate method to return false when the string in
between the % pair don't belong to the acceptable list, and was trying
to do that with an expression.

- Look for the string that is in between the "%" by the closest pair.

- The "%" pair must start at the "odd" occurrence and finish on the
"next even" occurrence...  Don't know how to describe this exactly, but
I don't want it to pack this up ("InBetween") from this
(C:\MyHomeDir\%Dept%InBetween%Person) even though it is in between a %
pair.

- Then compare the string within the "%" pair to see if it belongs to
the "acceptable" list or not.

=20

Is using a regular expression the right approach here?  or I should just
iterate thru?

=20

Thanks...

=20

--Chung Ley


------_=_NextPart_001_01C89F70.D96843D3--
 




 5 Posts in Topic:
Regular Expression Help
chung.ley@[EMAIL PROTECTE  2008-04-15 20:20:32 
Re: Regular Expression Help
jialinli1981@[EMAIL PROTE  2008-04-15 22:55:47 
RE: Regular Expression Help
chung.ley@[EMAIL PROTECTE  2008-04-15 20:58:55 
Re: Regular Expression Help
krahnj@[EMAIL PROTECTED]   2008-04-15 21:06:14 
Re: Regular Expression Help
rob.dixon@[EMAIL PROTECTE  2008-04-16 15:24:52 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Oct 14 9:55:58 CDT 2008.