code_junkie

Why ^*$ matches “127.0.0.1”

Nov 11th, 2011
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. ^*$
  2.  
  3. using System;
  4. using System.Text.RegularExpressions;
  5.  
  6. namespace RegexFubar
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. Console.WriteLine(Regex.IsMatch("127.0.0.1", "^*$"));
  13. Console.Read();
  14. }
  15. }
  16. }
  17.  
  18. # echo -n 127.0.0.1 | perl -n -e 'print (($_ =~ m/(^.*$)/)[0]),"n";'
  19. -> 127.0.0.1
  20. # echo -n 127.0.0.1 | perl -n -e 'print (($_ =~ m/(^*$)/)[0]),"n";'
  21. ->
  22.  
  23. Regex.Match("127.0.0.1", "^*1$")
  24.  
  25. ^+$
Add Comment
Please, Sign In to add comment