re help

mehta at mama.indstate.edu mehta at mama.indstate.edu
Thu Oct 21 21:37:33 EDT 1999


hello,

I am trying regular expression.  I want to match a java fuction like
public static void main (

see I want to avoid keywords in above declaration for scope, modifier,
returntype and name.  I am not sure how to make a regular expression
like

!keyword | [a-zA-Z][a-zA-Z0-9_]*
meaning no keyword or some return type

In article <380F2C6B.25E15957 at mmrd.com>,
  loril at mmrd.com wrote:
>
> --------------852473141D72DB77B0E853C6
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> not exactly sure what you are asking but I would do something like:
>
> someList = ["one", "two", "three"]
>
> if not x in someList:
>     # DO YOUR STUFF
> else:
>     print "ERROR: %s is in list"%x
>
> mehta at mama.indstate.edu wrote:
>
> > how can I specify not to match strings like
> >  donot match "one" | "two" | "three"
> >
> >   (one|two|three) could match any string as one or two or three
> > but I want them not to matched at that position.
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
> >
> > --
> > http://www.python.org/mailman/listinfo/python-list
>
> --------------852473141D72DB77B0E853C6
> Content-Type: text/html; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> <html>
> not exactly sure what you are asking but I would do something like:
> <p>someList = ["one", "two", "three"]
> <p>if not x in someList:
> <br><tt>    # DO YOUR STUFF</tt>
> <br><tt>else:</tt>
> <br><tt>    print "ERROR: %s is in list"%x</tt>
> <br><tt></tt> 
> <br><tt></tt> 
> <p>mehta at mama.indstate.edu wrote:
> <blockquote TYPE=CITE>how can I specify not to match strings like
> <br> donot match "one" | "two" | "three"
> <p>  (one|two|three) could match any string as one or two or
three
> <br>but I want them not to matched at that position.
> <p>Sent via Deja.com <a
href="http://www.deja.com/">http://www.deja.com/</a>
> <br>Before you buy.
> <p>--
> <br><a href="http://www.python.org/mailman/listinfo/python-
list">http://www.python.org/mailman/listinfo/python-
list</a></blockquote>
> </html>
>
> --------------852473141D72DB77B0E853C6--
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.




More information about the Python-list mailing list