RegEx help pls

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Thief_

    #1

    RegEx help pls

    I am trying to find the sentence for which a particular word exists in and
    have this expression:

    ([^>]*>)?country.+?( <|\.)

    In this example, I want it to find all sentences with the word "country" in
    it. So far, it finds a sentence but from the word "country" to the end of
    the sentence, but I can't figure out how to get the characters from the
    start of the sentence to the word "country". Can someone pls help me?

    Here is my sample data:

    <p9>
    Frequently Asked Questions (FAQs)
    <p10>






    <p11>
    Flags of the World.
    <p12>
    Gallery of Covers
    <p13>
    Text/Low Bandwidth Version
    <p14>
    <p15>
    Download This Publication
    <p16>
    Submit a Factual Update
    <p17>
    Search The World Factbook
    <p18>
    <p19>
    What's New
    <p20>
    - Country information has been updated as of 9 August, 2005.
    <p21>
    - There have been some significant changes to the latest edition of The
    World Factbook.
    Recent confirmation that the United Kingdom Government administers the
    Sovereign Base
    Areas of Akrotiri and Dhekelia on Cyprus as dependencies (and not as lease
    areas like
    the US Guantanamo Bay Naval Station in Cuba) has required a changing of
    their
    status and their addition to the Factbook as new entities. In addition, the
    European
    Union has been included as an "Other" entity at the end of the listing. The
    European
    Union continues to accrue more nation-like characteristics for itself and so
    a separate
    listing was deemed appropriate. A fuller explanation may be found under the
    European
    Union Preliminary statement.
    <p22>
    - Along with the new entities and the regular information updates, The World
    Factbook
    now also features six new fields. In the People category, a Major infectious
    diseases field
    has been added for countries deemed to pose a higher degree of risk for
    travelers. In the
    Economy category, entries have been added for Current account balance,
    Investment
    (gross fixed), Public debt, and Reserves of foreign exchange and gold. The
    Transnational
    issues category has a new Refugees and internally displaced persons entry.
    <p23>



    --
    |
    +-- Thief_
    |


  • Cor Ligthert [MVP]

    #2
    Re: RegEx help pls

    Thief,

    If I understand your problem right, is the most optimal method in VBnet for
    this the microsoft.visua lbasic.dll 'Find'.

    We have discussed this in this newsgroup in a test in october 2003 where I
    made a program with some simple tests.

    If you want to reread that thread.



    I hope this helps,

    Cor


    Comment

    • Cor Ligthert [MVP]

      #3
      Re: RegEx help pls

      Thief,

      If I understand your problem right, is the most optimal method in VBnet for
      this the microsoft.visua lbasic.dll 'Find'.

      We have discussed this in this newsgroup in a test in october 2003 where I
      made a program with some simple tests.

      If you want to reread that thread.



      I hope this helps,

      Cor


      Comment

      Working...