[Tutor] regular expressions
lbblair at adaptisinc.com
Thu Jun 24 13:11:10 EDT 2004
I am trying to use regular expressions to delete a wildcard set of tables.
My pattern is 'TEMP*' The code below is how I am implementing the delete.
My problem is that it also deletes a file 'SYSTEM' also. I can see where the
TEM parts match.
First is why does it ignore the P from the patterns?
Second I understand that search scans through the string looking for a
match. What I am wanting to do is use the \A switch , I think, that will
match only the start of the string. I have tried puting the switch in
various places and don't seem to quit understand where it should go. I need
an example :)
Thanks for any help
pattern = re.compile(del_pattern)
for each in os.listdir(file_location):
name = os.path.join(file_location, each)
type,value,tb = sys.exc_info()
Confidentiality Notice: This e-mail message, including any attachments, is
for the sole use of the intended recipient(s) and may contain information
that is confidential privileged and/or exempt from disclosure under
applicable law. Any unauthorized review, use, disclosure or distribution is
prohibited. If you are not the intended recipient, please contact the
sender by reply e-mail and destroy all copies of the original message.
More information about the Tutor