regexmatching

regexp, don't match url


I have to match words longer than 30 characters, but these words can't be urls.

I tried to do this, but doesn't work fine:

(?<!ftp)([^\s\t\r\n<>]{30})


Solution

  • I have a few points:

    Try this instead:

    (?<![^\s<>])(?!ftp)([^\s<>]{31,})(?![^\s<>])