• Post Reply Bookmark Topic Watch Topic
  • New Topic

Date regularExpression problem  RSS feed

 
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I created a method to check, if a string is formated like a date:


But my Eclipse ide is highlightning a part (19|20)\d in my regExp string and gives compilation error:
Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ )

What should I do?
[ May 02, 2006: Message edited by: Juhan Voolaid ]
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Double-escape your regex identifiers like this:

Because you are creating a string first, and then a regex from that string.
[ May 02, 2006: Message edited by: Jaap Vermeer ]
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!