Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #48341

Re: Pattern Search Regular Expression

Newsgroups comp.lang.python
Date 2013-06-15 10:54 -0700
References <afd6b280-3b64-467b-a2e1-2b36377cd13a@googlegroups.com>
Message-ID <83d2bb44-3379-4d98-8c35-6650ae3032a3@googlegroups.com> (permalink)
Subject Re: Pattern Search Regular Expression
From subhabangalore@gmail.com

Show all headers | View raw


On Saturday, June 15, 2013 3:12:55 PM UTC+5:30, subhaba...@gmail.com wrote:
> Dear Group,
> 
> 
> 
> I am trying to search the following pattern in Python.
> 
> 
> 
> I have following strings:
> 
> 
> 
>  (i)"In the ocean"
> 
>  (ii)"On the ocean"
> 
>  (iii) "By the ocean"
> 
>  (iv) "In this group"
> 
>  (v) "In this group"
> 
>  (vi) "By the new group"
> 
>        .....
> 
> 
> 
> I want to extract from the first word to the last word, 
> 
> where first word and last word are varying.
> 
> 
> 
> I am looking to extract out:
> 
>   (i) the
> 
>   (ii) the 
> 
>   (iii) the
> 
>   (iv) this
> 
>   (v) this
> 
>   (vi) the new
> 
>       .....
> 
> 
> 
> The problem may be handled by converting the string to list and then 
> 
> index of list. 
> 
> 
> 
> But I am thinking if I can use regular expression in Python.
> 
> 
> 
> If any one of the esteemed members can help.
> 
> 
> 
> Thanking you in Advance,
> 
> 
> 
> Regards,
> 
> Subhabrata

Dear Group,

Thank you for the answer. But I want to learn bit of interesting regular expression forms where may I? No Mark, thank you for your links but they were not sufficient. I am looking for more intriguing exercises, esp use of or in the pattern search. 

Regards,
Subhabrata. 

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Pattern Search Regular Expression subhabangalore@gmail.com - 2013-06-15 02:42 -0700
  Re: Pattern Search Regular Expression Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-15 10:05 +0000
    Re: Pattern Search Regular Expression Denis McMahon <denismfmcmahon@gmail.com> - 2013-06-15 10:24 +0000
      Re: Pattern Search Regular Expression Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-06-15 11:55 +0100
        Re: Pattern Search Regular Expression rusi <rustompmody@gmail.com> - 2013-06-15 04:28 -0700
        Re: Pattern Search Regular Expression Denis McMahon <denismfmcmahon@gmail.com> - 2013-06-15 13:41 +0000
          Re: Pattern Search Regular Expression Denis McMahon <denismfmcmahon@gmail.com> - 2013-06-15 13:45 +0000
            Re: Pattern Search Regular Expression Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-06-15 15:28 +0100
              Re: Pattern Search Regular Expression subhabangalore@gmail.com - 2013-06-15 07:31 -0700
                Re: Pattern Search Regular Expression Andreas Perstinger <andipersti@gmail.com> - 2013-06-15 17:01 +0200
                Re: Pattern Search Regular Expression Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-06-15 16:04 +0100
                Re: Pattern Search Regular Expression subhabangalore@gmail.com - 2013-06-15 09:28 -0700
                Re: Pattern Search Regular Expression Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-06-15 17:39 +0100
                Re: Pattern Search Regular Expression Terry Reedy <tjreedy@udel.edu> - 2013-06-15 16:24 -0400
  Re: Pattern Search Regular Expression Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-06-15 11:18 +0100
  Re: Pattern Search Regular Expression rurpy@yahoo.com - 2013-06-15 09:59 -0700
  Re: Pattern Search Regular Expression subhabangalore@gmail.com - 2013-06-15 10:54 -0700
    Re: Pattern Search Regular Expression rurpy@yahoo.com - 2013-06-15 11:47 -0700
      Re: Pattern Search Regular Expression subhabangalore@gmail.com - 2013-06-15 12:38 -0700
      Re: Pattern Search Regular Expression rurpy@yahoo.com - 2013-06-15 13:41 -0700
  Re: Pattern Search Regular Expression Joshua Landau <joshua.landau.ws@gmail.com> - 2013-06-15 22:03 +0100
  Re: Pattern Search Regular Expression Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-06-15 22:26 +0100

csiph-web