Regular Expression Help - Can it be done?

Discussion in 'Programming' started by PhuketGraphics, Nov 16, 2011.

  1. #1
    Hi Guys,

    Im wanting to know if the following is possible and if so, how it might be achieved.

    Im doing this using powergrep at the moment.. Here is my problem.

    As as example, say you have the following 2 lines.

    www.greatjewellery.com
    www.shineythings.com Jewellery

    What im wanting is a regular expression to search through each line looking for the word jewellery.... if it finds it, it grabs the URL that is on the same line..

    Ive been using this :

    (((ht|f)tps?:\/\/)|(www.))[a-zA-Z0-9_\-.:#/~}?]*jewellery[a-zA-Z0-9_\-.:#/~}?]+

    which grabs any URL with jewellery in it... this works fine BUT

    What i cant do is grab the second url (which doesnt have jewellery in the domain, but does in the description)


    in summery... if the search word "jewellery" is found anywhere on a line.. it grabs the URL that is on the same line.


    Hope this makes sense and would really appreciate any help you can give.

    Look forward to talking to you.


    Regards

    Dan
     
    PhuketGraphics, Nov 16, 2011 IP
  2. PhuketGraphics

    PhuketGraphics Greenhorn

    Messages:
    92
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #2
    Anything? Im sure one of you Regex wizards must know if this is possible.
     
    PhuketGraphics, Nov 18, 2011 IP