Friday 15 January 2010

language agnostic - Regex help: capture an entire line if it starts with a 1. or 2. -


I'm terrible at regexes, but would like some help in defining a rule that will take this text:

  • Il Cucio, via Ronchi 43 / B, 14047 Mombasi, Esti. Tel: 380 7277050 Fax: 0141 958 282 E-mail: info@ilcuccio.it www.ilcuccio.it
    Accommodation in communal rooms or tents. French and spoken English contacts: Christina Bellotti

  • Epicolta Lida Barbara, Strada Crvenzolo 21, Wig UZolo, 15058 Alessandria Telephone: 0131 89 9 6166 & amp; 392 9078020 E-mail: barbaraleida@tiscali.it is a farm located in the field, certified organic (CCPB).

  • Edit < / Strong>: As long as no one goes to me, I will show my work, additional points for a consistent explanation. In the second phase. Now I have ^ \ d + \. , which is a startlines, points, duration.

    in ruby ​​

      mystring = "1. el quasio, ronique 43 / B, 14047 Mombeselli, Asti. \ N TEL: 380 7277050 Fax: 0141 958 282 E-mail: info@ilcuccio.it www.ilcuccio.it \ N Candidates in communal rooms or tents French and English \ N Spoken contact: Christina Bellotti. \ N \ n2. Epicolta Lida Barbara, Strada Crvenzolo 21, wig uzzolo, 15058. Alessandria, NTEL: 0131 899166 and amp; 392 9078020 Email: barbaraleida@tiscali.it \ n Farm, Madeini Ela It has certified organic (CCPB) located in. \ N \ n "# Scans [[addr1 ']), [[Addr2'], ['addr3'], ...] are called mystring.scan ( / ^ \ D + \. (. +) $ /)  

    Output:

      Il Cucio, via Ronchi 43 / B, 14047 Lee, Asti Epicolta Lida Barbara, Strada Crvenzolo 21, Wig UZolo, 15058 Alessandria  

    No comments:

    Post a Comment