Reputation: 3661
I wrote this regex to find absolutely all kinds of comments in file, but it detects http://
also because of (//.*)
.
(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/)|(//.*)|(<!--[\s\S]*?-->)
How to modify this regex to not to find http:// etc? Do you think that it's optimal regex for this purpose? If not what do you suggest?
Upvotes: 0
Views: 134
Reputation: 11508
Looks like a lot of fun there. :) How about using the negative lookbehind technique with regex if it is supported with the setup you're using. Instead of:
//
use:
(?<!:)//
Upvotes: 1