Hi, I'm having trouble extracting substrings using regular expression. Here is my problem:
Want to find the substring that is immediately before a given substring. For example: from "00 noise1 01 noise2 00 target 01 target_mark", want to get "00 target 01" which is before "target_mark". My regular expression "(00.*?01) target_mark" will extract "00 noise1 01 noise2 00 target 01". I'm thinking that the solution to my problem might be to use a regular expression to exclude the substring "target_mark", which will replace the part of ".*" above. However, I don't know how to exclude a substring. Can anyone help on this? Or maybe give another solution to my problem? Thanks very much. -- http://mail.python.org/mailman/listinfo/python-list