-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathIPv6Regex.psm1
1707 lines (1407 loc) · 220 KB
/
IPv6Regex.psm1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<#
IPv6-Regex
Chris Warwick, @cjwarwickps, October 2015
This PowerShell script tests a number of regular expressions that match
text representations of IPv6 addresses. The script also runs the sample
test cases against the [System.Net.IpAddress]::TryParse() method to illustrate
some subtle considerations with address validation.
See the end of the script for further notes.
Script Structure
----------------
This script is split into four sections:
1. The first section defines an IPv6 regex to the tested against a set of sample addresses.
A number of other Regexs gathered from across the web are also defined here.
2. Following the regex definitions, an array of test script-blocks is defined. Each script
block takes a test IPv6 address as a parameter and tests this address against a specific
regex or against the IpAddress.TryParse() method. The script blocks return true if the
address is considered valid by the test or false otherwise.
3. The next (largest) section of the script defines sample IPv6 addresses to be tested. There
are a large number of both valid and invalid address representations defined.
4. The final section of the script runs the tests. Each test script block is selected in turn
and the test addresses are matched against the script blocks. Each test returns a test
result object containing details of the individual test. The tests are timed to allow
comparison of the performance of each test method (use the -Verbose switch to view timings).
NOTE: The output of this script is most useful as a consolidated report. Consequently, the
script 'breaks the rules' somewhat by including output formatting. This behaviour can be
changed by specifying the '-NoFormat' switch parameter to instruct the script to pass test-
result objects to the output pipeline (these can then be formatted or collected as required).
Results
-------
Unsurprisingly, a number of regexs found on the web are invalid (only one is included here,
others have been omitted). Beware of using random regexs without testing them.
There are some subtleties with the operation of the IpAddress.TestParse() method.
1. Both the regex and the IpAddress.TryParse() methods allow leading zeroes in the IPv4 octets. This is
actually explicitly invalid in the definition in rfc3986 (apparently some systems (?) use a leading zero
to denote an Octal number in the IPv4 Octet).
2. The IpAddress::TryParse method does not accept leading elided-zeroes syntax: ('::....') if there is
only one group (the first group) of the address mising - although this is valid according to the RFC. So,
for example, ::2:3:4:5:6:7 is considered valid by IpAddress::TryParse, but ::2:3:4:5:6:7:8 isn't
3. The IpAddress.TryParse() method by default accepts IPv4 addresses; these are qualified (filtered out)
by checking the address against the [System.Net.Sockets.AddressFamily]::InterNetworkV6 type
Compiling regexs is an expensive operation, and even for the relatively large number of tests defined
here the investment is not warranted.
Although the IpAddress.TryParse() method has some idiosyncrasies it may be preferred to the regex matching
methods given the complexity of these regexs (IpAddress.TryParse is probably equally as complex but the
complexity is at least hidden :-)
#>
Function IPv6Regex {
<#
.SYNOPSIS
Tests IPv6 Regex patterns against a large number of sample test addresses.
.DESCRIPTION
This function tests a number of IPv6 regexs against a selection of valid and invalid
IPv6 addresses to verify that the regexs perform as expected. The function also tests
the sample addresses using the [System.Net.IpAddress]::TryParse() method to illustrate
the performance and conformance of this method.
.NOTES
The script will time the relative performance of the various regexs; use the -Verbose
switch to display the timimg information.
.PARAMETER TestName
If specified, only run tests with names matching this.
.PARAMETER NoFormat
Provide raw output objects for each test. The default is to select only failing test
result objects and to format the resulting output. Use this parameter if you wish to
use a different selection or formatting option to the default provided here.
.EXAMPLE
IPv6Regex
Run all tests and display those that fail.
.EXAMPLE
IPv6Regex -Verbose
Run all tests; additionally display relative performance timings.
.EXAMPLE
IPv6Regex -TestName 'compiled'
Only run tests where the test name includes the string 'compiled'.
.EXAMPLE
IPv6Regex -NoFormat
Run all tests and output a raw RegexMatchResult object for each test.
.INPUTS
None
.OUTPUTS
By default, outputs formated table of failing tests. Use -NoFormat to output raw objects.
.FUNCTIONALITY
Test IPv6 Regexs against sample IPv6 Addresses.
.LINK
http://github.com/ChrisWarwick/IPv6Regex
#>
[OutputType('RegexMatchResult')]
[CmdletBinding()]
Param (
$TestName, # Only run tests with names matching this (default = run all tests)
[Switch]$NoFormat # Don't format the output (just retun TestResult objects)
)
#region Script Section 1. IPv6 Address Regexs.
# Some of these regexs are also compiled in order to compare performance
# IPv6 addresses are comprised of groups of 1-4 Hex digits:
$Hex = '[0-9a-f]{1,4}' # 1-4 hex characters (note: regex pattern is not case sensitive by default so "A-F" not included)
# IPv6 addresses can have an embedded IPv4 address in the last 4 bytes. This regex matches IPv4 if present:
# Component parts of an IPv4 Address Octet:
${250-255} = '25[0-5]' # Matches 3 digit numbers between 250 and 255
${200-249} = '2[0-4]\d' # Matches 3 digit numbers between 200 and 249
${100-199} = '1\d\d' # Matches 3 digit numbers between 100 and 199
${0-99} = '[1-9]?[0-9]' # Matches 1 or 2 digit numbers between 0 and 99
# Each Octet is one of the four possible components defined above..
$Octet = "( ${250-255} | ${200-249} | ${100-199} | ${0-99} )"
# IPv4 Address is 4 Octets separated by dots
$IP4 = "($Octet\.){3}$Octet"
$IPv6Regex = @"
(?ix) # Use extended-mode regex (white-space, comments and newlines in the regex definition are ignored)
^\s* # Allow optional whitespace before the address
# Note: All brackets are for grouping (the resulting captures are not used)
(
(( $Hex :){7} ($Hex |:)) | # 8 Groups of 1-4 Hex characters, or 7 Groups with elided zeroes after 7th group
(( $Hex :){6} (:$Hex | $IP4 |:)) | # Elided zeroes after 6th Group, or 6 Groups followed by dotted IP4
(( $Hex :){5} (((:$Hex){1,2})| : $IP4 |:)) | # g:g:g:g:g::g g:g:g:g:g::g:g g:g:g:g:g::ip4 g:g:g:g:g:: etc
(( $Hex :){4} (((:$Hex){1,3})|((:$Hex)? : $IP4 )|:)) | # g:g:g:g::g g:g:g:g::g:g g:g:g:g::g:g:g g:g:g:g::ip4 g:g:g:g::g:ip4 g:g:g:g:: etc
(( $Hex :){3} (((:$Hex){1,4})|((:$Hex){0,2}: $IP4 )|:)) |
(( $Hex :){2} (((:$Hex){1,5})|((:$Hex){0,3}: $IP4 )|:)) |
(( $Hex :){1} (((:$Hex){1,6})|((:$Hex){0,4}: $IP4 )|:)) | # g::g:g:g:g:g:g g::g:g:g:g:g ... g::g g:: g::g:g:g:g:ip4 .... g::ip4 etc
(:(((: $Hex ){1,7})|((:$Hex){0,5} : $IP4 )|:)) # Elided zeroes at front of address: ::g:g:g:g:g:g:g ::g ::g:ip4 etc
)
# (%.+)? # Match optional Zone Index (Scope ID) in Link Local address (there may be multiple link-local addresses (e.g. on different adapters) with different zone indexes)
\s*$ # Allow optional whitespace at the end of the address
"@
$CompiledIPv6Regex = New-Object -TypeName System.Text.RegularExpressions.Regex -ArgumentList ($IPv6Regex,[System.Text.RegularExpressions.RegexOptions]::Compiled)
# This sample is from the RegexBuddy Library
$RegexBuddy = @'
(?ix)
\A(?: # Anchor address
(?: # Mixed
(?:[A-F0-9]{1,4}:){6} # Non-compressed
|(?=(?:[A-F0-9]{0,4}:){2,6} # Compressed with 2 to 6 colons
(?:[0-9]{1,3}\.){3}[0-9]{1,3} # and 4 bytes
\z) # and anchored
(([0-9A-F]{1,4}:){1,5}|:)((:[0-9A-F]{1,4}){1,5}:|:) # and at most 1 double colon
|::(?:[A-F0-9]{1,4}:){5} # Compressed with 7 colons and 5 numbers
)
(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.){3} # 255.255.255.
(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9]) # 255
| # Standard
(?:[A-F0-9]{1,4}:){7}[A-F0-9]{1,4} # Standard
| # Compressed
(?=(?:[A-F0-9]{0,4}:){0,7}[A-F0-9]{0,4} # Compressed with at most 7 colons
\z) # and anchored
(([0-9A-F]{1,4}:){1,7}|:)((:[0-9A-F]{1,4}){1,7}|:) # and at most 1 double colon
|(?:[A-F0-9]{1,4}:){7}:|:(:[A-F0-9]{1,4}){7} # Compressed with 8 colons
)\z # Anchor address
'@
$CompiledRegexBuddy = New-Object -TypeName System.Text.RegularExpressions.Regex -ArgumentList ($RegexBuddy,[System.Text.RegularExpressions.RegexOptions]::Compiled)
$Php1 = @'
(?ix)
\A
(?:
# mixed
(?:
# Non-compressed
(?:[A-F0-9]{1,4}:){6}
# Compressed with at most 6 colons
|(?=(?:[A-F0-9]{0,4}:){0,6}
(?:[0-9]{1,3}\.){3}[0-9]{1,3} # and 4 bytes
\Z) # and anchored
# and at most 1 double colon
(([A-F0-9]{1,4}:){0,5}|:)((:[A-F0-9]{1,4}){1,5}:|:)
)
# 255.255.255.
(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}
# 255
(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)
# Standard
|(?:[A-F0-9]{1,4}:){7}[A-F0-9]{1,4}
# Compressed with at most 7 colons
|(?=(?:[A-F0-9]{0,4}:){0,7}[A-F0-9]{0,4}
\Z) # anchored
# and at most 1 double colon
(([A-F0-9]{1,4}:){1,7}|:)((:[A-F0-9]{1,4}){1,7}|:)
)\Z
'@
#endregion Script Section 1. IPv6 Address Regexs.
#region Script Section 2. Test Method Script Blocks.
# "$TestMethods" is an array of custom objects, each consisting of a test method name and a ScriptBlock that implements the test.
# The ScriptBlock is passed a sample IPv6 address and returns True/False depending on whether the method considers the address valid.
$TestMethods = @(
# Test the IPv6 regex defined above
[PsCustomObject] @{
Name = 'IPv6 Regex'
ScriptBlock = {
Param ([String]$TestAddress)
Return ($TestAddress -Match $IPv6Regex)
}
}
# Test the Compiled IPv6 regex defined above
[PsCustomObject] @{
Name = 'Compiled IPv6 Regex'
ScriptBlock = {
Param ([String]$TestAddress)
Return ($CompiledIPv6Regex.IsMatch($TestAddress))
}
}
[PsCustomObject] @{
Name = 'Php1'
ScriptBlock = {
Param ([String]$TestAddress)
Return ($TestAddress -Match $Php1)
}
}
[PsCustomObject] @{
Name = 'RegexBuddy'
ScriptBlock = {
Param ([String]$TestAddress)
Return ($TestAddress -Match $RegexBuddy)
}
}
[PsCustomObject] @{
Name = 'Compiled RegexBuddy'
ScriptBlock = {
Param ([String]$TestAddress)
Return ($CompiledRegexBuddy.IsMatch($TestAddress))
}
}
# Tests using the [System.Net.IpAddress]::TryParse() method
[PsCustomObject] @{
Name = 'Net IpAddress TryParse() Method'
ScriptBlock = {
Param ([String]$TestAddress)
$IP = $Null
Return ([System.Net.IPAddress]::TryParse($TestAddress,[Ref]$IP))
}
}
[PsCustomObject] @{
Name = 'Qualified Net IpAddress TryParse() Method'
ScriptBlock = {
Param ([String]$TestAddress)
$IP = $Null
If ([System.Net.IPAddress]::TryParse($TestAddress,[Ref]$IP)) {
Return ($IP.AddressFamily -eq [System.Net.Sockets.AddressFamily]::InterNetworkV6)
}
else {
Return $False
}
}
}
# .Net example from http://home.deds.nl/~aeron/regex/
[PsCustomObject] @{
Name = 'Aeron Regex'
ScriptBlock = {
Param ([String]$TestAddress)
$Aeron = '^(((?=.*(::))(?!.*\3.+\3))\3?|[0-9A-F]{1,4}:)([0-9A-F]{1,4}(\3|:\b)|\2){5}(([0-9A-F]{1,4}(\3|:\b|$)|\2){2}|(((2[0-4]|1[0-9]|[1-9])?[0-9]|25[0-5])\.?\b){4})\z'
Return ($TestAddress -Match $Aeron)
}
}
)
#endregion Script Section 2. Test Method Script Blocks.
#region Script Section 3. Test IPv6 Addresses.
$Ipv6TestAddresses = @(
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '' } # empty string
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::1' } # loopback, compressed, non-routable
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::' } # unspecified, compressed, non-routable
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '0:0:0:0:0:0:0:1' } # loopback, full
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '0:0:0:0:0:0:0:0' } # unspecified, full
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '2001:DB8:0:0:8:800:200C:417A' } # unicast, full
[PsCustomObject] @{ Valid = $True; TestIPv6Address = 'FF01:0:0:0:0:0:0:101' } # multicast, full
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '2001:DB8::8:800:200C:417A' } # unicast, compressed
[PsCustomObject] @{ Valid = $True; TestIPv6Address = 'FF01::101' } # multicast, compressed
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '2001:DB8:0:0:8:800:200C:417A:221' } # unicast, full
[PsCustomObject] @{ Valid = $False; TestIPv6Address = 'FF01::101::2' } # multicast, compressed
[PsCustomObject] @{ Valid = $True; TestIPv6Address = 'fe80::217:f2ff:fe07:ed62' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '2001:0000:1234:0000:0000:C1C0:ABCD:0876' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '3ffe:0b00:0000:0000:0001:0000:0000:000a' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = 'FF02:0000:0000:0000:0000:0000:0000:0001' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '0000:0000:0000:0000:0000:0000:0000:0001' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '0000:0000:0000:0000:0000:0000:0000:0000' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '02001:0000:1234:0000:0000:C1C0:ABCD:0876' } # extra 0 not allowed
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '2001:0000:1234:0000:00001:C1C0:ABCD:0876' } # extra 0 not allowed
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '2001:0000:1234:0000:0000:C1C0:ABCD:0876 0' } # junk after valid address
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '2001:0000:1234: 0000:0000:C1C0:ABCD:0876' } # internal space
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '3ffe:0b00:0000:0001:0000:0000:000a' } # seven segments
[PsCustomObject] @{ Valid = $False; TestIPv6Address = 'FF02:0000:0000:0000:0000:0000:0000:0000:0001' } # nine segments
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '3ffe:b00::1::a' } # double '::'
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::1111:2222:3333:4444:5555:6666::' } # double '::'
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '2::10' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = 'ff02::1' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = 'fe80::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '2002::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '2001:db8::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '2001:0db8:1234::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::ffff:0:0' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::1' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1:2:3:4:5:6:7:8' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1:2:3:4:5:6::8' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1:2:3:4:5::8' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1:2:3:4::8' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1:2:3::8' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1:2::8' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1::8' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1::2:3:4:5:6:7' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1::2:3:4:5:6' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1::2:3:4:5' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1::2:3:4' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1::2:3' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1::8' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::2:3:4:5:6:7:8' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::2:3:4:5:6:7' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::2:3:4:5:6' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::2:3:4:5' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::2:3:4' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::2:3' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::8' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1:2:3:4:5:6::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1:2:3:4:5::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1:2:3:4::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1:2:3::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1:2::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1:2:3:4:5::7:8' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1:2:3::4:5::7:8' } # Double '::'
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '12345::6:7:8' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1:2:3:4::7:8' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1:2:3::7:8' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1:2::7:8' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1::7:8' }
# IPv4 addresses as dotted-quads
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1:2:3:4:5:6:1.2.3.4' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1:2:3:4:5::1.2.3.4' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1:2:3:4::1.2.3.4' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1:2:3::1.2.3.4' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1:2::1.2.3.4' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1::1.2.3.4' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1:2:3:4::5:1.2.3.4' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1:2:3::5:1.2.3.4' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1:2::5:1.2.3.4' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1::5:1.2.3.4' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1::5:11.22.33.44' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::5:400.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::5:260.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::5:256.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::5:1.256.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::5:1.2.256.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::5:1.2.3.256' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::5:300.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::5:1.300.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::5:1.2.300.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::5:1.2.3.300' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::5:900.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::5:1.900.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::5:1.2.900.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::5:1.2.3.900' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::5:300.300.300.300' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::5:3000.30.30.30' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::400.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::260.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::256.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::1.256.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::1.2.256.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::1.2.3.256' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::300.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::1.300.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::1.2.300.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::1.2.3.300' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::900.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::1.900.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::1.2.900.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::1.2.3.900' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::300.300.300.300' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::3000.30.30.30' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::400.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::260.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::256.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::1.256.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::1.2.256.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::1.2.3.256' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::300.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::1.300.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::1.2.300.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::1.2.3.300' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::900.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::1.900.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::1.2.900.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::1.2.3.900' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::300.300.300.300' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::3000.30.30.30' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = 'fe80::217:f2ff:254.7.237.98' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::ffff:192.168.1.26' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '2001:1:1:1:1:1:255Z255X255Y255' } # garbage instead of '.' in IPv4
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::ffff:192x168.1.26' } # ditto
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::ffff:192.168.1.1' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '0:0:0:0:0:0:13.1.68.3' } # IPv4-compatible IPv6 address, full, deprecated
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '0:0:0:0:0:FFFF:129.144.52.38' } # IPv4-mapped IPv6 address, full
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::13.1.68.3' } # IPv4-compatible IPv6 address, compressed, deprecated
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::FFFF:129.144.52.38' } # IPv4-mapped IPv6 address, compressed
[PsCustomObject] @{ Valid = $True; TestIPv6Address = 'fe80:0:0:0:204:61ff:254.157.241.86' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = 'fe80::204:61ff:254.157.241.86' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::ffff:12.34.56.78' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::ffff:2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::ffff:257.1.2.3' }
# [PsCustomObject] @{ Valid = $False; TestIPv6Address = '1.2.3.4' } # Duplicate below
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1.2.3.4:1111:2222:3333:4444::5555' } # Aeron
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1.2.3.4:1111:2222:3333::5555' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1.2.3.4:1111:2222::5555' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1.2.3.4:1111::5555' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1.2.3.4::5555' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1.2.3.4::' }
# Testing IPv4 addresses represented as dotted-quads
# Leading zero' }s in IPv4 addresses not allowed: some systems treat the leading '0' in '.086' as the start of an octal number
# Update: The BNF in RFC-3986 explicitly defines the dec-octet (for IPv4 addresses) not to have a leading zero
[PsCustomObject] @{ Valid = $False; TestIPv6Address = 'fe80:0000:0000:0000:0204:61ff:254.157.241.086' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::ffff:192.0.2.128' } # but this is OK, since there's a single digit
[PsCustomObject] @{ Valid = $False; TestIPv6Address = 'XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:6666:00.00.00.00' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:6666:000.000.000.000' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:6666:256.256.256.256' }
# Not testing address with subnet mask
# [PsCustomObject] @{ Valid = $True; TestIPv6Address = '2001:0DB8:0000:CD30:0000:0000:0000:0000/60' } # full, with prefix
# [PsCustomObject] @{ Valid = $True; TestIPv6Address = '2001:0DB8::CD30:0:0:0:0/60' } # compressed, with prefix
# [PsCustomObject] @{ Valid = $True; TestIPv6Address = '2001:0DB8:0:CD30::/60' } # compressed, with prefix #2
# [PsCustomObject] @{ Valid = $True; TestIPv6Address = '::/128' } # compressed, unspecified address type, non-routable
# [PsCustomObject] @{ Valid = $True; TestIPv6Address = '::1/128' } # compressed, loopback address type, non-routable
# [PsCustomObject] @{ Valid = $True; TestIPv6Address = 'FF00::/8' } # compressed, multicast address type
# [PsCustomObject] @{ Valid = $True; TestIPv6Address = 'FE80::/10' } # compressed, link-local unicast, non-routable
# [PsCustomObject] @{ Valid = $True; TestIPv6Address = 'FEC0::/10' } # compressed, site-local unicast, deprecated
# [PsCustomObject] @{ Valid = $False; TestIPv6Address = '124.15.6.89/60' } # standard IPv4, prefix not allowed
[PsCustomObject] @{ Valid = $True; TestIPv6Address = 'fe80:0000:0000:0000:0204:61ff:fe9d:f156' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = 'fe80:0:0:0:204:61ff:fe9d:f156' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = 'fe80::204:61ff:fe9d:f156' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::1' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = 'fe80::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = 'fe80::1' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::ffff:c000:280' }
# Aeron supplied these test cases
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444::5555:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333::5555:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222::5555:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111::5555:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::5555:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':::' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222:3333:4444::5555' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222:3333::5555' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222::5555' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111::5555' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':::5555' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':::' }
# Additional test cases
# from http://rt.cpan.org/Public/Bug/Display.html?id=50693
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '2001:0db8:85a3:0000:0000:8a2e:0370:7334' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '2001:db8:85a3:0:0:8a2e:370:7334' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '2001:db8:85a3::8a2e:370:7334' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '2001:0db8:0000:0000:0000:0000:1428:57ab' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '2001:0db8:0000:0000:0000::1428:57ab' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '2001:0db8:0:0:0:0:1428:57ab' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '2001:0db8:0:0::1428:57ab' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '2001:0db8::1428:57ab' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '2001:db8::1428:57ab' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '0000:0000:0000:0000:0000:0000:0000:0001' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::1' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::ffff:0c22:384e' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '2001:0db8:1234:0000:0000:0000:0000:0000' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '2001:0db8:1234:ffff:ffff:ffff:ffff:ffff' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '2001:db8:a::123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = 'fe80::' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '123' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = 'ldkfj' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '2001::FFD3::57ab' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '2001:db8:85a3::8a2e:37023:7334' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '2001:db8:85a3::8a2e:370k:7334' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1:2:3:4:5:6:7:8:9' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1::2::3' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1:::3:4:5' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1:2:3::4:5:6:7:8:9' }
# From Aeron
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444:5555:6666:7777::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444:5555:6666::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444:5555::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444:5555:6666::8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444:5555::8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444::8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333::8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222::8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111::8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444:5555::7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444::7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333::7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222::7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111::7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444::6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333::6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222::6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111::6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333::5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222::5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111::5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222::4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111::4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111::3333:4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::3333:4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::2222:3333:4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444:5555:6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444:5555::123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444::123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333::123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222::123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111::123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444::6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333::6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222::6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111::6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333::5555:6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222::5555:6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111::5555:6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::5555:6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222::4444:5555:6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111::4444:5555:6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::4444:5555:6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111::3333:4444:5555:6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::2222:3333:4444:5555:6666:123.123.123.123' }
# Combinations of '0' and '::'
# NB: these are all sytactically correct, but are bad form
# because '0' adjacent to '::' should be combined into '::'
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::0:0:0:0:0:0:0' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::0:0:0:0:0:0' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::0:0:0:0:0' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::0:0:0:0' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::0:0:0' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::0:0' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::0' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '0:0:0:0:0:0:0::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '0:0:0:0:0:0::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '0:0:0:0:0::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '0:0:0:0::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '0:0:0::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '0:0::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '0::' }
# New invalid from Aeron
# Invalid data
[PsCustomObject] @{ Valid = $False; TestIPv6Address = 'XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX' }
# Too many components
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:6666:7777:8888:9999' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:6666:7777:8888::' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::2222:3333:4444:5555:6666:7777:8888:9999' }
# Too few components
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:6666:7777' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:6666' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111' }
# Missing :
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '11112222:3333:4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:22223333:4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:33334444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:44445555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:55556666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:66667777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:6666:77778888' }
# Missing : intended for ::
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:6666:7777:8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:6666:7777:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:6666:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':3333:4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':2222:3333:4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222:3333:4444:5555:6666:7777:8888' }
# :::
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':::2222:3333:4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:::3333:4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:::4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:::5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:::6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:::7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:6666:::8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:6666:7777:::' }
# Double ::' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::2222::4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::2222:3333::5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::2222:3333:4444::6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::2222:3333:4444:5555::7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::2222:3333:4444:5555:7777::8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::2222:3333:4444:5555:7777:8888::' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111::3333::5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111::3333:4444::6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111::3333:4444:5555::7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111::3333:4444:5555:6666::8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111::3333:4444:5555:6666:7777::' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222::4444::6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222::4444:5555::7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222::4444:5555:6666::8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222::4444:5555:6666:7777::' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333::5555::7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333::5555:6666::8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333::5555:6666:7777::' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444::6666::8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444::6666:7777::' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555::7777::' }
# Too many components' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:6666:7777:8888:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:6666:7777:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:6666::1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::2222:3333:4444:5555:6666:7777:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:6666:1.2.3.4.5' }
# Too few components
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1.2.3.4' }
# Missing :
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '11112222:3333:4444:5555:6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:22223333:4444:5555:6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:33334444:5555:6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:44445555:6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:55556666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:66661.2.3.4' }
# Missing .
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:6666:255255.255.255' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:6666:255.255255.255' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:6666:255.255.255255' }
# Missing : intended for ::
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':5555:6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':4444:5555:6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':3333:4444:5555:6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':2222:3333:4444:5555:6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222:3333:4444:5555:6666:1.2.3.4' }
# :::
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':::2222:3333:4444:5555:6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:::3333:4444:5555:6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:::4444:5555:6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:::5555:6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:::6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:::1.2.3.4' }
# Double ::
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::2222::4444:5555:6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::2222:3333::5555:6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::2222:3333:4444::6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::2222:3333:4444:5555::1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111::3333::5555:6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111::3333:4444::6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111::3333:4444:5555::1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222::4444::6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222::4444:5555::1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333::5555::1.2.3.4' }
# Missing parts
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::.' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::..' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::...' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::1...' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::1.2..' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::1.2.3.' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::.2..' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::.2.3.' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::..3.' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::..3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::...4' }
# Extra : in front
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222:3333:4444:5555:6666:7777::' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222:3333:4444:5555:6666::' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222:3333:4444:5555::' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222:3333:4444::' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222:3333::' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222::' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111::' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':::' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222:3333:4444:5555:6666::8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222:3333:4444:5555::8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222:3333:4444::8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222:3333::8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222::8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111::8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':::8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222:3333:4444:5555::7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222:3333:4444::7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222:3333::7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222::7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111::7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':::7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222:3333:4444::6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222:3333::6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222::6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111::6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':::6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222:3333::5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222::5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111::5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':::5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222::4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111::4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':::4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111::3333:4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':::3333:4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':::2222:3333:4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222:3333:4444:5555:6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222:3333:4444:5555::1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222:3333:4444::1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222:3333::1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222::1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111::1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':::1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222:3333:4444::6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222:3333::6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222::6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111::6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':::6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222:3333::5555:6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222::5555:6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111::5555:6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':::5555:6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111:2222::4444:5555:6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111::4444:5555:6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':::4444:5555:6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':1111::3333:4444:5555:6666:1.2.3.4' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':::2222:3333:4444:5555:6666:1.2.3.4' }
# Extra : at end
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:6666:7777:::' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:6666:::' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:::' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:::' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:::' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:::' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:::' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':::' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:6666::8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555::8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444::8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333::8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222::8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111::8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555::7777:8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444::7777:8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333::7777:8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222::7777:8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111::7777:8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::7777:8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444::6666:7777:8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333::6666:7777:8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222::6666:7777:8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111::6666:7777:8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::6666:7777:8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333::5555:6666:7777:8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222::5555:6666:7777:8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111::5555:6666:7777:8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::5555:6666:7777:8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222::4444:5555:6666:7777:8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111::4444:5555:6666:7777:8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::4444:5555:6666:7777:8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111::3333:4444:5555:6666:7777:8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::3333:4444:5555:6666:7777:8888:' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::2222:3333:4444:5555:6666:7777:8888:' }
# Additional cases: http://crisp.tweakblogs.net/blog/2031/ipv6-validation-%28and-caveats%29.html
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '0:a:b:c:d:e:f::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::0:a:b:c:d:e:f' } # syntactically correct, but bad form (::0:... could be combined)
[PsCustomObject] @{ Valid = $True; TestIPv6Address = 'a:b:c:d:e:f:0::' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = ':10.0.0.1' }
# Further test cases...
## From: http://home.deds.nl/~aeron/regex/valid_ipv6.txt
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444:5555:6666:7777::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444:5555:6666::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444:5555::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444:5555:6666::8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444:5555::8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444::8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333::8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222::8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111::8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444:5555::7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444::7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333::7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222::7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111::7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444::6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333::6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222::6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111::6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333::5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222::5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111::5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222::4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111::4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111::3333:4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::3333:4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::2222:3333:4444:5555:6666:7777:8888' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444:5555:6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444:5555::123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444::123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333::123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222::123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111::123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333:4444::6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333::6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222::6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111::6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222:3333::5555:6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222::5555:6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111::5555:6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::5555:6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111:2222::4444:5555:6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111::4444:5555:6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::4444:5555:6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '1111::3333:4444:5555:6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::3333:4444:5555:6666:123.123.123.123' }
[PsCustomObject] @{ Valid = $True; TestIPv6Address = '::2222:3333:4444:5555:6666:123.123.123.123' }
## From: http://home.deds.nl/~aeron/regex/invalid_ipv6.txt
# Invalid data
[PsCustomObject] @{ Valid = $False; TestIPv6Address = 'XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX' }
# To many components
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:6666:7777:8888:9999' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:6666:7777:8888::' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '::2222:3333:4444:5555:6666:7777:8888:9999' }
# To few components
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:6666:7777' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555:6666' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444:5555' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333:4444' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222:3333' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111:2222' }
[PsCustomObject] @{ Valid = $False; TestIPv6Address = '1111' }