Skip to content

Instantly share code, notes, and snippets.

@fajran
Created November 7, 2010 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fajran/666295 to your computer and use it in GitHub Desktop.
Save fajran/666295 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
while (<>) {
if (/^re.+p.$/) { # regex sudah menjadi bagian bahasa perl
print; # tidak terlihat jelas apa yang di-print
}
}
#!/usr/bin/python
import sys
import re
pattern = re.compile(r'^re.+p.$') # regex itu adalah modul di python
for line in sys.stdin:
if pattern.match(line):
sys.stdout.write(line) # apa yang ingin dicetak disebut secara eksplisit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment