Guest User

Untitled

a guest
Apr 23rd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. =================================================
  2.  
  3. #!perl
  4. use warnings;
  5. use strict;
  6. my $regex = qr/(.)1{9,}/;
  7. print "NO" if "abcdefghijklmno" =~ $regex;
  8. print "YES" if "------------------------" =~ $regex;
  9. print "YES" if "========================" =~ $regex;
  10.  
  11. txt = """1. aaaaaaaaaaaaaaa
  12. 2. bb
  13. 3. cccccccccccccccccccc
  14. 4. dd
  15. 5. eeeeeeeeeeee"""
  16. rx = re.compile(r'(.)1{9,}')
  17. lines = txt.split('n')
  18. for line in lines:
  19. rxx = rx.search(line)
  20. if rxx:
  21. print line
  22.  
  23. 1. aaaaaaaaaaaaaaa
  24. 3. cccccccccccccccccccc
  25. 5. eeeeeeeeeeee
  26.  
  27. $: cat > test
  28. ========
  29. ============================
  30. oo
  31. ooooooooooooooooooooooo
  32.  
  33.  
  34. $: grep -E '(.)1{10}' test
  35. ============================
  36. ooooooooooooooooooooooo
  37.  
  38. ={10,}
  39.  
  40. $: cat > testre
  41. ============================
  42. ==
  43. ==============
  44.  
  45. $: grep -E '={10,}' testre
  46. ============================
  47. ==============
Add Comment
Please, Sign In to add comment