0

how do i match the first string?

e.g.

txt: now>=2017-03-07-00&now<=2017-04-05-00

patterns ".*?now>=(.*)-00"

gives me: 2017-03-07-00&now<=2017-04-05

instead of: 2017-03-07

Elad Benda2
  • 13,852
  • 29
  • 82
  • 157
  • Use `now>=(.*?)-00` with `Matcher.find()`. – Wiktor Stribiżew Mar 07 '17 at 10:19
  • Matcher `.*?now>=(.*)-00` won't work for two reasons: first, it is greedy, which can be fixed with `.*?now>=(.*?)-00`. In addition, you'll need something for tailing characters, so total would be `.*?now>=(.*?)-00.*` – eis Mar 07 '17 at 10:32

0 Answers0