Pattern Search Regular Expression

subhabangalore at gmail.com subhabangalore at gmail.com
Sat Jun 15 12:28:49 EDT 2013


On Saturday, June 15, 2013 8:34:59 PM UTC+5:30, Mark Lawrence wrote:
> On 15/06/2013 15:31, subhabangalore at gmail.com wrote:
> 
> >
> 
> > Dear Group,
> 
> >
> 
> > I know this solution but I want to have Regular Expression option. Just learning.
> 
> >
> 
> > Regards,
> 
> > Subhabrata.
> 
> >
> 
> 
> 
> Start here http://docs.python.org/2/library/re.html
> 
> 
> 
> Would you also please read and action this, 
> 
> http://wiki.python.org/moin/GoogleGroupsPython , thanks.
> 
> 
> 
> -- 
> 
> "Steve is going for the pink ball - and for those of you who are 
> 
> watching in black and white, the pink is next to the green." Snooker 
> 
> commentator 'Whispering' Ted Lowe.
> 
> 
> 
> Mark Lawrence

Dear Group,

Suppose I want a regular expression that matches both "Sent from my iPhone" and "Sent from my iPod". How do I write such an expression--is the problem, 
"Sent from my iPod"
"Sent from my iPhone"

which can be written as,
re.compile("Sent from my (iPhone|iPod)")

now if I want to slightly to extend it as,

"Taken from my iPod"
"Taken from my iPhone"

I am looking how can I use or in the beginning pattern?

and the third phase if the intermediate phrase,

"from my" if also differs or changes.

In a nutshell I want to extract a particular group of phrases,
where, the beginning and end pattern may alter like,

(i) either from beginning Pattern B1 to end Pattern E1,
(ii) or from beginning Pattern B1 to end Pattern E2,
(iii) or from beginning Pattern B2 to end Pattern E2,
.....

Regards,
Subhabrata.









More information about the Python-list mailing list