-2

This is the code:

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

This is the output:

None

Cœur
  • 37,241
  • 25
  • 195
  • 267
mattalxndr
  • 9,143
  • 8
  • 56
  • 87

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
  • 60
  • 3
  • 8