0

I have the following String:

vitals.date_created==2013-7-3 11:23:32

I am using the regex

([a-zA-Z0-9_]+[$.]?[a-zA-Z0-9_]+)+[><=]=?[a-z0-9A-Z'\\.@- ]+

but the regex doesn't work.

Yu Hao
  • 119,891
  • 44
  • 235
  • 294
Phalguni Mukherjee
  • 623
  • 3
  • 11
  • 29

1 Answers1

0

Two things:

  1. You are creating a character range in the last character class and this is in the wrong order (error on some systems)

    ([a-zA-Z0-9_]+[$.]?[a-zA-Z0-9_]+)+[><=]=?[a-z0-9A-Z'\\.@- ]+
                                                           ^^^
    

    I assume you don't want a range of characters here, so escape the dash or move it to the end:

    ([a-zA-Z0-9_]+[$.]?[a-zA-Z0-9_]+)+[><=]=?[a-z0-9A-Z'\\.@ -]+
    
  2. The time in your string has colons, your last character class hasn't. How should it match? Just add them to the class:

    ([a-zA-Z0-9_]+[$.]?[a-zA-Z0-9_]+)+[><=]=?[a-z0-9A-Z'\\.@: -]+
    

See it here on Regexr

stema
  • 90,351
  • 20
  • 107
  • 135