Regular Expression

java India
  • 12 years ago

    Hi,

    Please read example to get my requirement.

     String: "cancer of lung is example string to dig out the cancer."

    I want to get cancer only in case when "cancer" is following "of lung".

    is there any single regular expression which can do this.

     

    Regards,

    Ashwani
     

  • 12 years ago

    I got it.

    i can use this

    [a-zA-Z]+(?=( )of( )lung) 

     but take the below example

    "lung cancer of lung is called as something of lung "

    now my requirement is i want "cancer lung" and "something lung" through one regular expression.

     

    any help. 

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Before software should be reusable, it should be usable.” - Ralph Johnson