• Post Reply Bookmark Topic Watch Topic
  • New Topic

validating using parser  RSS feed

 
Eyal Golan
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
We have a situation which we need to check if an in-house filter is valid.
valid input can be something like the following:
(Location=Cayman) or (&(Location=Cayman)(Organization=Finance))
There are more options, but this is the basic.

We have a code that checks if the input is valid:


The problem happens when a field consists with chars like '('.
I want to create something that uses the Pattern class.

Is it possible?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If this was my problem I'd write a lexer for the syntax, using a library like JFlex. They make for much more maintainable code for handling custom formats like these.
 
Eyal Golan
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ulf.
I'm looking into it.
It's a topic I haven't worked with it yet.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I may strut my own stuff, here's an introductory article I wrote on using lexers: Handling Uncommon File Formats - Introducing Lexers.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!