-2

This is the code:

import re
regex = re.compile('java')
print regex.match('/something.java')

This is the output:

None

Cœur
  • 34,719
  • 24
  • 185
  • 251
mattalxndr
  • 8,380
  • 6
  • 54
  • 85

1 Answers1

1

Because python match matches from the beginning. see python -- re.match vs. re.search you need to use pattern .*java if you want to use match.

Community
  • 1
  • 1
voyta
  • 50
  • 3
  • 8