[Tutor] Regular expression

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Fri Oct 8 02:10:33 CEST 2004



On Thu, 7 Oct 2004, kumar s wrote:

> Dear group,
>  I have a string that looks like this:
> [AKT|PI3K][RHOA|BCL:CDC42:IKK:RAC1:RAL:RALBP1]

Hi Kumar,


Hmmm!  Ok, it sounds like you're making some kind of mini-language to make
it easier to type out Graphviz dotty files.  Each one of these out-edge
descriptions appears to have some kind of structure:

    out_edge_description ::=
       open_brace
       start_vertex_name
       pipe_symbol
       a_bunch_of_colon_separated_names
       close_brace

We can parse this pretty informally, by using regular expressions.  But
there's also a fairly systematic way we can attack this:  we can go all
out and use a token/parser approach.  Would you like to hear about that?

Also, just to make sure, have you had a chance to look at the Regular
Expression HOWTO?

    http://www.amk.ca/python/howto/regex/

Good luck to you!



More information about the Tutor mailing list