Advertisement
go6odn28

longest_regex

Mar 16th, 2024
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.22 KB | None | 0 0
  1. import re
  2. pattern = r'^(?<fullAddress>(?<mailbox>([a-zA-Z0-9\+\!\#\$\%\&\\*\-\\=\?\+\_\{\}\/\~]I(?<singleDot>(?<!\.)(?<!^)\.(?!\.))|(?<foldedWhiteSpace>\s?\&\#13\;\&\#10\;-)){1,64})\s?(?<singleAt>(?<!\@)(?<!\-)(?<!\.)\@(?!\@))(?<domain>(?<dns>[[:alnum:]]([[:alnum:]\-]{0,63}\.){1,24}[[:alnum:]\-]{1,63}[[:alnum:]])|(?<IPv4>\[((?:25[0-5]12[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\])|(?<IPv6Full>(\[IPv6(\:[0-9a-fA-F]{1,4}}{8}\]))I(?<IPv6Comp1>\[IPv6\:((([0-9a-fA-F]{1,4})\:){1,3}(\:([0-9a-fA-F]{1,4})){1,5}?\])|\[IPv6\:((([0-9a-fA-F]{1,4})\:){1,5}(\:([0-9a-fA-F]{1,4})){1,3}?\]))|(?<IPv6Comp2>(\[IPv6\:\:(\:[0-9a-fA-F]{1,4}){1,6}]))I(?<IPv6Comp3>(\[IPv6\:([0-9a-fA-F]{1,4}\:){1,6}\:\]))I(?<IPv6Comp4>(\[IPv6\:\:\:)\])|(?<IPv6v4Full>(\[IPv6([0-9a-fA-F]{1,4}){6}\:((?:25[0-5]12[0-4][0-9]|[01]?[0-9][0-9]?)\.){3})(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\])|(?<IPv6v4Comp1>\[IPv6\:((([0-9a-fA-F]{1,4})\:){1,3}(\:([0-9a-fA-F]{1,4})){1,5}?(\:((?:25[0-5]12[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]12[0-4][0-9]|[01]?[0-9][0-9]?))\])|\[IPv6\:((([0-9a-fA-F]{1,4})\:){1,5}(\:([0-9a-fA-F]{1,4})){1,3}?(\:((?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))\]))|(?<IPv6v4Comp2>(\[IPv6\:\:(\:[0-9a-fA-F]{1,4}){1,5}(\:((?:25[0-5]12[0-4][0-9]|[01]?[0-9] [0-9]?)\.){3}(?:25[0-5]12[0-4][0-9]|[01]?[0-9][0-9]?))\]))|(?<IPv6v4Comp3>(\[IPv6\:([0-9a-fA-F]{1,4}\:){1,5}\:(((?:25[0-5]12[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]12[0-4] [0-9]|[01]?[0-9][0-9]?))\]))|(?<IPv6v4Comp4>(\[IPv6\:\:\:((?:25[0-5]12[0-4][0-9]|[01]?[0-9][0-9]?)\.){3})(?:25[0-5]12[0-4][0-9]|[01]?[0-9][0-9]?)\])))'
  3.  
  4.  
  5. pattern_repaired = r'^(?P<fullAddress>)(?P<mailbox>([a-zA-Z0-9\+\!\#\$\%\&\\*\-\\=\?\+\_\{\}\/\~]I(P?<singleDot>(?<!\.)(?<!^)\.(?!\.))|(?P<foldedWhiteSpace>\s?\&\#13\;\&\#10\;-)){1,64})\s?(?P<singleAt>)(?<!\@)(?<!\-)(?<!\.)\@(?!\@)(?P<domain>)(?P<dns>[[:alnum:]]([[:alnum:]\-]{0,63}\.){1,24}[[:alnum:]\-]{1,63}[[:alnum:]])|(?P<IPv4>\[((?:25[0-5]12[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\])|(?P<IPv6Full>(\[IPv6(\:[0-9a-fA-F]{1,4}}{8}\]))I(?P<IPv6Comp1>\[IPv6\:((([0-9a-fA-F]{1,4})\:){1,3}(\:([0-9a-fA-F]{1,4})){1,5}?\])|\[IPv6\:((([0-9a-fA-F]{1,4})\:){1,5}(\:([0-9a-fA-F]{1,4})){1,3}?\]))|(?P<IPv6Comp2>(\[IPv6\:\:(\:[0-9a-fA-F]{1,4}){1,6}]))I(?P<IPv6Comp3>(\[IPv6\:([0-9a-fA-F]{1,4}\:){1,6}\:\])I(?P<IPv6Comp4>(\[IPv6\:\:\:)\])|(?P<IPv6v4Full>(\[IPv6([0-9a-fA-F]{1,4}){6}\:((?:25[0-5]12[0-4][0-9]|[01]?[0-9][0-9]?)\.){3})(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\])|(?P<IPv6v4Comp1>\[IPv6\:((([0-9a-fA-F]{1,4})\:){1,3}(\:([0-9a-fA-F]{1,4})){1,5}?(\:((?:25[0-5]12[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]12[0-4][0-9]|[01]?[0-9][0-9]?))\])|\[IPv6\:((([0-9a-fA-F]{1,4})\:){1,5}(\:([0-9a-fA-F]{1,4})){1,3}?(\:((?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))\]))|(?P<IPv6v4Comp2>(\[IPv6\:\:(\:[0-9a-fA-F]{1,4}){1,5}(\:((?:25[0-5]12[0-4][0-9]|[01]?[0-9] [0-9]?)\.){3}(?:25[0-5]12[0-4][0-9]|[01]?[0-9][0-9]?))\]))|(?P<IPv6v4Comp3>(\[IPv6\:([0-9a-fA-F]{1,4}\:){1,5}\:(((?:25[0-5]12[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]12[0-4] [0-9]|[01]?[0-9][0-9]?))\]))|(?P<IPv6v4Comp4>(\[IPv6\:\:\:((?:25[0-5]12[0-4][0-9]|[01]?[0-9][0-9]?)\.){3})(?:25[0-5]12[0-4][0-9]|[01]?[0-9][0-9]?)\])))'
  6.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement