[Tutor] Regular Expression Help

Jacob Abraham jakieabraham at yahoo.com
Tue Sep 30 02:42:16 EDT 2003


Dear Tutor,
   I am having some trouble with my regular
expressions.
Here is my problem.
1. Find the word 'Required_Text:'
2. Find All characters till
    a.A new line character or
    b.The word 'Required_'

   These were my failed attempts 

import re
reg=re.search
a='''Some Text Required_Text: Some other text and
(23.32) numbers Required_Field: Some more text'''
b=reg('Required_Text:.*(Required_)?',a)
b.group()
'Required_Text: Some other text and (23.32) numbers
Required_Field: Some more text'
b=reg('Required_Text:.*?(Required_)?',a)
'Required_Field:'



Please help me capture 
'Required_Text: Some other text and (23.32) numbers
Required_'


__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com



More information about the Tutor mailing list