Back

If your email is not recognized and you believe it should be, please contact us.

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Mark Coster
    Member

    Hi everyone

    I’m fairly new to GREP, but I started experimenting with it on the magazine that I produce and sure enough I ran into ‘The URL problem’ that everyone inevitably does! I initially came up with a fairly long code that targeted URLs that did not have ‘https://’ or ‘www.’ at the start because that was the magazine’s house style:

    (\w+|\w+-|\w+/)*(\w+\.[\u]+(\.[\u]+)*)(/\w+(/w+|-\w+)*)*

    But then I looked at the problem again and tried to simplify each element until I got the following:

    ([^]+)\.([^]+)

    This (as far as I can see with the testing I have done so far) finds any url irrespective of what’s in it. I tested it on Casey’s sample text in his post and it makes the same matches (unless I missed something). I’d love any feedback or suggestions of how to improve it. I also posted this on my own blog (https://www.pixooma.co.uk/blog/2013/08/31/url-grep-simplified/) as I’d like to come back to this topic regularly.

    Mark

Viewing 1 post (of 1 total)