Hi,

i'd like to test if an input string starts with a python expression
and also where that expression ends.  An example:

a_func(3*7, '''abc''') +5 pls some more

The first part until (inclusive) the 5 should be found as an expression
and the length of that string should also be detected.


Background is that i want to embed some python expressions in a text
and i want to evaluate them later.
It is possible that the embedded expressions span several lines.

Alternatively, is it possible to define a start- and an end-marker
that define the embedded expression and find the expression using
a regular expression?
If the expression contains strings, these strings could contain
the end-marker which should not be found inside strings.

Example:

start: <
end:   >

< some_func(r">")>


Can anybody tell me how to do this best?

Can i do this using just modules from the python library?


Thanks for any hints,
Torsten.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to