c-hive / guides

Guides for code style, way of working and other development concerns
MIT License
26 stars 5 forks source link

Improvement to your regex to not allow consecutive periods, or dashes at the end of the domain #48

Open jumpsmm7 opened 10 months ago

jumpsmm7 commented 10 months ago

^(?!.*?([\.]{2,}?|[\_]{1,}?).*?)(?!(?:[\d\w]+?\.)?\-[\w\d\.\-]*?)(?![\w\d]+?\-\.(?:[\d\w\.\-]+?))(?=[\w\d])(?=[\w\d\.\-]*?\.+[\w\d\.\-]*?)(?![\w\d\.\-]{254})(?!(?:\.?[\w\d\-\.]*?[\w\d\-]{64,}?\.)+?)[\w\d\.\-]+?(?<![\w\d\-\.]*?\.[\d]+?)(?<=[\w\d\-]{2,}?)(?<![\w\d\-]{25})(?<![\-]{1,}?)$